From 5d55126cda4a7880a84999f18234fd45944f0d34 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 20 May 2022 06:43:10 +0000 Subject: [PATCH] CodeGen from PR 3141 in openapi-env-test/azure-rest-api-specs Merge b94599706bf448d7b81be3096271534ecd28791e into 96477cbb296f594f198631984be173065b2393ee --- sdk/iothub/azure-mgmt-iothub/_meta.json | 8 +- .../mgmt/iothub/v2016_02_03/_configuration.py | 9 +- .../iothub/v2016_02_03/_iot_hub_client.py | 12 +- .../mgmt/iothub/v2016_02_03/_metadata.json | 4 +- .../azure/mgmt/iothub/v2016_02_03/_version.py | 2 +- .../iothub/v2016_02_03/aio/_configuration.py | 9 +- .../iothub/v2016_02_03/aio/_iot_hub_client.py | 10 +- .../_iot_hub_resource_operations.py | 266 +- .../_iot_hub_resource_operations.py | 672 ++- .../mgmt/iothub/v2017_01_19/_configuration.py | 9 +- .../iothub/v2017_01_19/_iot_hub_client.py | 12 +- .../mgmt/iothub/v2017_01_19/_metadata.json | 4 +- .../azure/mgmt/iothub/v2017_01_19/_version.py | 2 +- .../iothub/v2017_01_19/aio/_configuration.py | 9 +- .../iothub/v2017_01_19/aio/_iot_hub_client.py | 10 +- .../_iot_hub_resource_operations.py | 239 +- .../_iot_hub_resource_operations.py | 645 ++- .../azure/mgmt/iothub/v2017_07_01/__init__.py | 18 - .../mgmt/iothub/v2017_07_01/_configuration.py | 68 - .../iothub/v2017_07_01/_iot_hub_client.py | 99 - .../mgmt/iothub/v2017_07_01/_metadata.json | 104 - .../azure/mgmt/iothub/v2017_07_01/_patch.py | 31 - .../azure/mgmt/iothub/v2017_07_01/_vendor.py | 27 - .../azure/mgmt/iothub/v2017_07_01/_version.py | 9 - .../mgmt/iothub/v2017_07_01/aio/__init__.py | 15 - .../iothub/v2017_07_01/aio/_configuration.py | 67 - .../iothub/v2017_07_01/aio/_iot_hub_client.py | 97 - .../mgmt/iothub/v2017_07_01/aio/_patch.py | 31 - .../v2017_07_01/aio/operations/__init__.py | 17 - .../operations/_certificates_operations.py | 425 -- .../_iot_hub_resource_operations.py | 1438 ------ .../v2017_07_01/aio/operations/_operations.py | 110 - .../iothub/v2017_07_01/models/__init__.py | 131 - .../models/_iot_hub_client_enums.py | 121 - .../iothub/v2017_07_01/models/_models_py3.py | 2376 ---------- .../iothub/v2017_07_01/operations/__init__.py | 17 - .../operations/_certificates_operations.py | 677 --- .../_iot_hub_resource_operations.py | 2150 --------- .../v2017_07_01/operations/_operations.py | 135 - .../azure/mgmt/iothub/v2017_07_01/py.typed | 1 - .../azure/mgmt/iothub/v2018_01_22/__init__.py | 18 - .../mgmt/iothub/v2018_01_22/_configuration.py | 68 - .../iothub/v2018_01_22/_iot_hub_client.py | 99 - .../mgmt/iothub/v2018_01_22/_metadata.json | 104 - .../azure/mgmt/iothub/v2018_01_22/_patch.py | 31 - .../azure/mgmt/iothub/v2018_01_22/_vendor.py | 27 - .../azure/mgmt/iothub/v2018_01_22/_version.py | 9 - .../mgmt/iothub/v2018_01_22/aio/__init__.py | 15 - .../iothub/v2018_01_22/aio/_configuration.py | 67 - .../iothub/v2018_01_22/aio/_iot_hub_client.py | 97 - .../mgmt/iothub/v2018_01_22/aio/_patch.py | 31 - .../v2018_01_22/aio/operations/__init__.py | 17 - .../operations/_certificates_operations.py | 425 -- .../_iot_hub_resource_operations.py | 1557 ------- .../v2018_01_22/aio/operations/_operations.py | 110 - .../iothub/v2018_01_22/models/__init__.py | 133 - .../models/_iot_hub_client_enums.py | 121 - .../iothub/v2018_01_22/models/_models_py3.py | 2407 ---------- .../iothub/v2018_01_22/operations/__init__.py | 17 - .../operations/_certificates_operations.py | 677 --- .../_iot_hub_resource_operations.py | 2312 --------- .../v2018_01_22/operations/_operations.py | 135 - .../azure/mgmt/iothub/v2018_01_22/py.typed | 1 - .../azure/mgmt/iothub/v2018_04_01/__init__.py | 18 - .../mgmt/iothub/v2018_04_01/_configuration.py | 68 - .../iothub/v2018_04_01/_iot_hub_client.py | 103 - .../mgmt/iothub/v2018_04_01/_metadata.json | 105 - .../azure/mgmt/iothub/v2018_04_01/_patch.py | 31 - .../azure/mgmt/iothub/v2018_04_01/_vendor.py | 27 - .../azure/mgmt/iothub/v2018_04_01/_version.py | 9 - .../mgmt/iothub/v2018_04_01/aio/__init__.py | 15 - .../iothub/v2018_04_01/aio/_configuration.py | 67 - .../iothub/v2018_04_01/aio/_iot_hub_client.py | 101 - .../mgmt/iothub/v2018_04_01/aio/_patch.py | 31 - .../v2018_04_01/aio/operations/__init__.py | 19 - .../operations/_certificates_operations.py | 425 -- .../_iot_hub_resource_operations.py | 1759 ------- .../v2018_04_01/aio/operations/_operations.py | 110 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2018_04_01/models/__init__.py | 173 - .../models/_iot_hub_client_enums.py | 150 - .../iothub/v2018_04_01/models/_models_py3.py | 3020 ------------ .../iothub/v2018_04_01/operations/__init__.py | 19 - .../operations/_certificates_operations.py | 677 --- .../_iot_hub_resource_operations.py | 2637 ----------- .../v2018_04_01/operations/_operations.py | 135 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2018_04_01/py.typed | 1 - .../azure/mgmt/iothub/v2019_03_22/__init__.py | 18 - .../mgmt/iothub/v2019_03_22/_configuration.py | 68 - .../iothub/v2019_03_22/_iot_hub_client.py | 106 - .../mgmt/iothub/v2019_03_22/_metadata.json | 106 - .../azure/mgmt/iothub/v2019_03_22/_patch.py | 31 - .../azure/mgmt/iothub/v2019_03_22/_vendor.py | 27 - .../azure/mgmt/iothub/v2019_03_22/_version.py | 9 - .../mgmt/iothub/v2019_03_22/aio/__init__.py | 15 - .../iothub/v2019_03_22/aio/_configuration.py | 67 - .../iothub/v2019_03_22/aio/_iot_hub_client.py | 104 - .../mgmt/iothub/v2019_03_22/aio/_patch.py | 31 - .../v2019_03_22/aio/operations/__init__.py | 21 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1759 ------- .../v2019_03_22/aio/operations/_operations.py | 110 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2019_03_22/models/__init__.py | 177 - .../models/_iot_hub_client_enums.py | 167 - .../iothub/v2019_03_22/models/_models_py3.py | 3077 ------------ .../iothub/v2019_03_22/operations/__init__.py | 21 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2637 ----------- .../v2019_03_22/operations/_operations.py | 135 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2019_03_22/py.typed | 1 - .../iothub/v2019_07_01_preview/__init__.py | 18 - .../v2019_07_01_preview/_configuration.py | 68 - .../v2019_07_01_preview/_iot_hub_client.py | 107 - .../iothub/v2019_07_01_preview/_metadata.json | 106 - .../mgmt/iothub/v2019_07_01_preview/_patch.py | 31 - .../iothub/v2019_07_01_preview/_vendor.py | 27 - .../iothub/v2019_07_01_preview/_version.py | 9 - .../v2019_07_01_preview/aio/__init__.py | 15 - .../v2019_07_01_preview/aio/_configuration.py | 67 - .../aio/_iot_hub_client.py | 105 - .../iothub/v2019_07_01_preview/aio/_patch.py | 31 - .../aio/operations/__init__.py | 21 - .../operations/_certificates_operations.py | 426 -- .../aio/operations/_iot_hub_operations.py | 157 - .../_iot_hub_resource_operations.py | 1761 ------- .../aio/operations/_operations.py | 110 - .../_resource_provider_common_operations.py | 91 - .../v2019_07_01_preview/models/__init__.py | 181 - .../models/_iot_hub_client_enums.py | 166 - .../v2019_07_01_preview/models/_models_py3.py | 3180 ------------- .../operations/__init__.py | 21 - .../operations/_certificates_operations.py | 678 --- .../operations/_iot_hub_operations.py | 204 - .../_iot_hub_resource_operations.py | 2642 ----------- .../operations/_operations.py | 136 - .../_resource_provider_common_operations.py | 124 - .../mgmt/iothub/v2019_07_01_preview/py.typed | 1 - .../azure/mgmt/iothub/v2019_11_04/__init__.py | 18 - .../mgmt/iothub/v2019_11_04/_configuration.py | 68 - .../iothub/v2019_11_04/_iot_hub_client.py | 106 - .../mgmt/iothub/v2019_11_04/_metadata.json | 106 - .../azure/mgmt/iothub/v2019_11_04/_patch.py | 31 - .../azure/mgmt/iothub/v2019_11_04/_vendor.py | 27 - .../azure/mgmt/iothub/v2019_11_04/_version.py | 9 - .../mgmt/iothub/v2019_11_04/aio/__init__.py | 15 - .../iothub/v2019_11_04/aio/_configuration.py | 67 - .../iothub/v2019_11_04/aio/_iot_hub_client.py | 104 - .../mgmt/iothub/v2019_11_04/aio/_patch.py | 31 - .../v2019_11_04/aio/operations/__init__.py | 21 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1759 ------- .../v2019_11_04/aio/operations/_operations.py | 110 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2019_11_04/models/__init__.py | 179 - .../models/_iot_hub_client_enums.py | 167 - .../iothub/v2019_11_04/models/_models_py3.py | 3136 ------------- .../iothub/v2019_11_04/operations/__init__.py | 21 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2637 ----------- .../v2019_11_04/operations/_operations.py | 135 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2019_11_04/py.typed | 1 - .../azure/mgmt/iothub/v2020_03_01/__init__.py | 18 - .../mgmt/iothub/v2020_03_01/_configuration.py | 68 - .../iothub/v2020_03_01/_iot_hub_client.py | 114 - .../mgmt/iothub/v2020_03_01/_metadata.json | 108 - .../azure/mgmt/iothub/v2020_03_01/_patch.py | 31 - .../azure/mgmt/iothub/v2020_03_01/_vendor.py | 27 - .../azure/mgmt/iothub/v2020_03_01/_version.py | 9 - .../mgmt/iothub/v2020_03_01/aio/__init__.py | 15 - .../iothub/v2020_03_01/aio/_configuration.py | 67 - .../iothub/v2020_03_01/aio/_iot_hub_client.py | 112 - .../mgmt/iothub/v2020_03_01/aio/_patch.py | 31 - .../v2020_03_01/aio/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1759 ------- .../v2020_03_01/aio/operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 407 -- .../_private_link_resources_operations.py | 157 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2020_03_01/models/__init__.py | 199 - .../models/_iot_hub_client_enums.py | 190 - .../iothub/v2020_03_01/models/_models_py3.py | 3613 -------------- .../iothub/v2020_03_01/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2637 ----------- .../v2020_03_01/operations/_operations.py | 135 - ...private_endpoint_connections_operations.py | 565 --- .../_private_link_resources_operations.py | 231 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2020_03_01/py.typed | 1 - .../iothub/v2021_03_03_preview/__init__.py | 18 - .../v2021_03_03_preview/_configuration.py | 68 - .../v2021_03_03_preview/_iot_hub_client.py | 115 - .../iothub/v2021_03_03_preview/_metadata.json | 108 - .../mgmt/iothub/v2021_03_03_preview/_patch.py | 31 - .../iothub/v2021_03_03_preview/_vendor.py | 27 - .../iothub/v2021_03_03_preview/_version.py | 9 - .../v2021_03_03_preview/aio/__init__.py | 15 - .../v2021_03_03_preview/aio/_configuration.py | 67 - .../aio/_iot_hub_client.py | 113 - .../iothub/v2021_03_03_preview/aio/_patch.py | 31 - .../aio/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 426 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1768 ------- .../aio/operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 407 -- .../_private_link_resources_operations.py | 157 - .../_resource_provider_common_operations.py | 91 - .../v2021_03_03_preview/models/__init__.py | 225 - .../models/_iot_hub_client_enums.py | 217 - .../v2021_03_03_preview/models/_models_py3.py | 4112 ---------------- .../operations/__init__.py | 25 - .../operations/_certificates_operations.py | 678 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2658 ----------- .../operations/_operations.py | 136 - ...private_endpoint_connections_operations.py | 565 --- .../_private_link_resources_operations.py | 231 - .../_resource_provider_common_operations.py | 124 - .../mgmt/iothub/v2021_03_03_preview/py.typed | 1 - .../azure/mgmt/iothub/v2021_03_31/__init__.py | 18 - .../mgmt/iothub/v2021_03_31/_configuration.py | 68 - .../iothub/v2021_03_31/_iot_hub_client.py | 114 - .../mgmt/iothub/v2021_03_31/_metadata.json | 108 - .../azure/mgmt/iothub/v2021_03_31/_patch.py | 31 - .../azure/mgmt/iothub/v2021_03_31/_vendor.py | 27 - .../azure/mgmt/iothub/v2021_03_31/_version.py | 9 - .../mgmt/iothub/v2021_03_31/aio/__init__.py | 15 - .../iothub/v2021_03_31/aio/_configuration.py | 67 - .../iothub/v2021_03_31/aio/_iot_hub_client.py | 112 - .../mgmt/iothub/v2021_03_31/aio/_patch.py | 31 - .../v2021_03_31/aio/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1768 ------- .../v2021_03_31/aio/operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 407 -- .../_private_link_resources_operations.py | 157 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2021_03_31/models/__init__.py | 219 - .../models/_iot_hub_client_enums.py | 216 - .../iothub/v2021_03_31/models/_models_py3.py | 4016 ---------------- .../iothub/v2021_03_31/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2655 ----------- .../v2021_03_31/operations/_operations.py | 135 - ...private_endpoint_connections_operations.py | 565 --- .../_private_link_resources_operations.py | 231 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2021_03_31/py.typed | 1 - .../azure/mgmt/iothub/v2021_07_01/__init__.py | 18 - .../mgmt/iothub/v2021_07_01/_configuration.py | 68 - .../iothub/v2021_07_01/_iot_hub_client.py | 114 - .../mgmt/iothub/v2021_07_01/_metadata.json | 108 - .../azure/mgmt/iothub/v2021_07_01/_patch.py | 31 - .../azure/mgmt/iothub/v2021_07_01/_vendor.py | 27 - .../azure/mgmt/iothub/v2021_07_01/_version.py | 9 - .../mgmt/iothub/v2021_07_01/aio/__init__.py | 15 - .../iothub/v2021_07_01/aio/_configuration.py | 67 - .../iothub/v2021_07_01/aio/_iot_hub_client.py | 112 - .../mgmt/iothub/v2021_07_01/aio/_patch.py | 31 - .../v2021_07_01/aio/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1768 ------- .../v2021_07_01/aio/operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 407 -- .../_private_link_resources_operations.py | 157 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2021_07_01/models/__init__.py | 219 - .../models/_iot_hub_client_enums.py | 216 - .../iothub/v2021_07_01/models/_models_py3.py | 4072 ---------------- .../iothub/v2021_07_01/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2655 ----------- .../v2021_07_01/operations/_operations.py | 135 - ...private_endpoint_connections_operations.py | 565 --- .../_private_link_resources_operations.py | 231 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2021_07_01/py.typed | 1 - .../azure/mgmt/iothub/v2021_07_02/__init__.py | 18 - .../mgmt/iothub/v2021_07_02/_configuration.py | 68 - .../iothub/v2021_07_02/_iot_hub_client.py | 114 - .../mgmt/iothub/v2021_07_02/_metadata.json | 108 - .../azure/mgmt/iothub/v2021_07_02/_patch.py | 31 - .../azure/mgmt/iothub/v2021_07_02/_vendor.py | 27 - .../azure/mgmt/iothub/v2021_07_02/_version.py | 9 - .../mgmt/iothub/v2021_07_02/aio/__init__.py | 15 - .../iothub/v2021_07_02/aio/_configuration.py | 67 - .../iothub/v2021_07_02/aio/_iot_hub_client.py | 112 - .../mgmt/iothub/v2021_07_02/aio/_patch.py | 31 - .../v2021_07_02/aio/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 425 -- .../aio/operations/_iot_hub_operations.py | 160 - .../_iot_hub_resource_operations.py | 1768 ------- .../v2021_07_02/aio/operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 407 -- .../_private_link_resources_operations.py | 157 - .../_resource_provider_common_operations.py | 91 - .../iothub/v2021_07_02/models/__init__.py | 223 - .../models/_iot_hub_client_enums.py | 225 - .../iothub/v2021_07_02/models/_models_py3.py | 4150 ----------------- .../iothub/v2021_07_02/operations/__init__.py | 25 - .../operations/_certificates_operations.py | 677 --- .../operations/_iot_hub_operations.py | 207 - .../_iot_hub_resource_operations.py | 2655 ----------- .../v2021_07_02/operations/_operations.py | 135 - ...private_endpoint_connections_operations.py | 565 --- .../_private_link_resources_operations.py | 231 - .../_resource_provider_common_operations.py | 124 - .../azure/mgmt/iothub/v2021_07_02/py.typed | 1 - 324 files changed, 1286 insertions(+), 122387 deletions(-) delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_patch.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_iot_hub_client_enums.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py delete mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/py.typed diff --git a/sdk/iothub/azure-mgmt-iothub/_meta.json b/sdk/iothub/azure-mgmt-iothub/_meta.json index 7e8005ab6368..e465dc9048f1 100644 --- a/sdk/iothub/azure-mgmt-iothub/_meta.json +++ b/sdk/iothub/azure-mgmt-iothub/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", - "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 --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "commit": "065dbcc7ad60ffeeed1b63447c5c963067b0798d", + "repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs", + "autorest_command": "autorest specification/iothub/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/iothub/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py index 6e6027d8fc1d..36f78231494e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class IotHubClientConfiguration(Configuration): +class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotHubClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotHubClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-02-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-02-03" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) self._configure(**kwargs) 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 9119653bc5df..7bdf8c72db5d 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import IotHubClientConfiguration @@ -30,8 +31,11 @@ class IotHubClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-02-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -55,7 +59,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 fea5ebde91cf..bdb3ae9f0db8 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 @@ -10,8 +10,8 @@ "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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { 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 f30401ec2040..e5754a47ce68 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 = "2.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py index b421ff804730..f576af7c8677 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class IotHubClientConfiguration(Configuration): +class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotHubClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotHubClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-02-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-02-03" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) self._configure(**kwargs) 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 6724987d2c6c..dd845949f980 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import IotHubClientConfiguration @@ -31,8 +32,11 @@ class IotHubClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-02-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ 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 25aa4329f8d7..5235a98ea53d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class IotHubResourceOperations: +class IotHubResourceOperations: # pylint: disable=too-many-public-methods """IotHubResourceOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -74,17 +73,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore async def _create_or_update_initial( @@ -107,6 +113,8 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -115,7 +123,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(iot_hub_description, 'IotHubDescription') @@ -123,6 +131,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -130,7 +139,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -148,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace_async @@ -157,6 +170,8 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -173,6 +188,9 @@ async def begin_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.v2016_02_03.models.IotHubDescription + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -187,8 +205,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,6 +219,7 @@ async def begin_create_or_update( resource_name=resource_name, iot_hub_description=iot_hub_description, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -224,10 +243,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore async def _delete_initial( self, @@ -241,17 +259,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -273,7 +298,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace_async @@ -306,7 +331,8 @@ async def begin_delete( ~azure.mgmt.iothub.v2016_02_03.models.ErrorDetails] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + 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', @@ -317,6 +343,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -340,10 +367,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -361,6 +387,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +399,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -380,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -397,7 +427,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,7 +445,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def list_by_resource_group( @@ -432,6 +466,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -443,6 +479,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -453,6 +490,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -470,7 +508,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,7 +526,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace_async async def get_stats( @@ -512,17 +554,24 @@ async def get_stats( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_stats_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_stats.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -537,7 +586,7 @@ async def get_stats( return deserialized - get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + get_stats.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore @distributed_trace @@ -562,6 +611,8 @@ def get_valid_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -574,6 +625,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -585,6 +637,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -602,7 +655,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -616,7 +673,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + get_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore @distributed_trace def list_event_hub_consumer_groups( @@ -645,6 +702,8 @@ def list_event_hub_consumer_groups( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -658,6 +717,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=self.list_event_hub_consumer_groups.metadata['url'], ) request = _convert_request(request) @@ -670,6 +730,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -687,7 +748,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -701,7 +766,7 @@ async def get_next(next_link=None): 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 + list_event_hub_consumer_groups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore @distributed_trace_async async def get_event_hub_consumer_group( @@ -735,6 +800,8 @@ async def get_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -742,12 +809,17 @@ async def get_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.get_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -762,7 +834,7 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + get_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace_async @@ -797,6 +869,8 @@ async def create_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_create_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -804,12 +878,17 @@ async def create_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.create_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -824,11 +903,11 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + create_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace_async - async def delete_event_hub_consumer_group( + async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -859,6 +938,8 @@ async def delete_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_delete_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -866,12 +947,17 @@ async def delete_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.delete_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -882,7 +968,7 @@ async def delete_event_hub_consumer_group( 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 + delete_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -909,6 +995,8 @@ def list_jobs( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -921,6 +1009,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_jobs.metadata['url'], ) request = _convert_request(request) @@ -932,6 +1021,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -949,7 +1039,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -963,7 +1057,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + list_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore @distributed_trace_async async def get_job( @@ -996,18 +1090,25 @@ async def get_job( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_job_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, job_id=job_id, + api_version=api_version, template_url=self.get_job.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1022,7 +1123,7 @@ async def get_job( return deserialized - get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + get_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore @distributed_trace @@ -1047,6 +1148,8 @@ def get_quota_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1059,6 +1162,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_quota_metrics.metadata['url'], ) request = _convert_request(request) @@ -1070,6 +1174,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1087,7 +1192,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1101,12 +1210,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + get_quota_metrics.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore @distributed_trace_async async def check_name_availability( self, operation_inputs: "_models.OperationInputs", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1116,6 +1227,9 @@ 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.v2016_02_03.models.OperationInputs + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo @@ -1127,12 +1241,13 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(operation_inputs, 'OperationInputs') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1140,7 +1255,11 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1155,7 +1274,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore @distributed_trace @@ -1182,6 +1301,8 @@ def list_keys( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1194,6 +1315,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -1205,6 +1327,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1222,7 +1345,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1236,7 +1363,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore @distributed_trace_async async def get_keys_for_key_name( @@ -1269,18 +1396,25 @@ async def get_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_keys_for_key_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, key_name=key_name, + api_version=api_version, template_url=self.get_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1295,7 +1429,7 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + get_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore @distributed_trace_async @@ -1304,6 +1438,8 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob @@ -1320,6 +1456,9 @@ async def export_devices( :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse @@ -1331,7 +1470,7 @@ async def export_devices( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') @@ -1339,6 +1478,7 @@ async def export_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.export_devices.metadata['url'], @@ -1346,7 +1486,11 @@ async def export_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1361,7 +1505,7 @@ async def export_devices( return deserialized - export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + export_devices.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore @distributed_trace_async @@ -1370,6 +1514,8 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For @@ -1386,6 +1532,9 @@ async def import_devices( :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse @@ -1397,7 +1546,7 @@ async def import_devices( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') @@ -1405,6 +1554,7 @@ async def import_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.import_devices.metadata['url'], @@ -1412,7 +1562,11 @@ async def import_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1427,5 +1581,5 @@ async def import_devices( return deserialized - import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore + 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/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 3083dd943d56..e6277c99a55a 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,31 +35,32 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,35 +74,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-03") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-02-03" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,31 +115,32 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -147,29 +149,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -179,30 +182,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -213,31 +217,32 @@ def build_get_stats_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -248,31 +253,32 @@ def build_get_valid_skus_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -284,10 +290,11 @@ def build_list_event_hub_consumer_groups_request( event_hub_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -295,21 +302,21 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -322,10 +329,11 @@ def build_get_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -334,21 +342,21 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -361,10 +369,11 @@ def build_create_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -373,21 +382,21 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -400,10 +409,11 @@ def build_delete_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -412,21 +422,21 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -437,31 +447,32 @@ def build_list_jobs_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -473,10 +484,11 @@ def build_get_job_request( job_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -484,21 +496,21 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -509,31 +521,32 @@ def build_get_quota_metrics_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -545,33 +558,33 @@ def build_check_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-03") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-02-03" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -584,31 +597,32 @@ def build_list_keys_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -620,10 +634,11 @@ def build_get_keys_for_key_name_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-02-03" + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -631,21 +646,21 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -659,35 +674,35 @@ def build_export_devices_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-03") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-02-03" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -703,41 +718,41 @@ def build_import_devices_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-03") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-02-03" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class IotHubResourceOperations(object): +class IotHubResourceOperations(object): # pylint: disable=too-many-public-methods """IotHubResourceOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -785,17 +800,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,7 +832,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore def _create_or_update_initial( @@ -818,6 +840,8 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -826,7 +850,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(iot_hub_description, 'IotHubDescription') @@ -834,6 +858,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -841,7 +866,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -859,7 +888,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace @@ -868,6 +897,8 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> LROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -884,6 +915,9 @@ def begin_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.v2016_02_03.models.IotHubDescription + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -897,8 +931,8 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -911,6 +945,7 @@ def begin_create_or_update( resource_name=resource_name, iot_hub_description=iot_hub_description, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -934,10 +969,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore def _delete_initial( self, @@ -951,17 +985,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -983,7 +1024,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace @@ -1015,7 +1056,8 @@ def begin_delete( or ~azure.mgmt.iothub.v2016_02_03.models.ErrorDetails] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + 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', @@ -1026,6 +1068,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1049,10 +1092,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -1070,6 +1112,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1080,6 +1124,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1089,6 +1134,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1106,7 +1152,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1120,7 +1170,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def list_by_resource_group( @@ -1141,6 +1191,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1152,6 +1204,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -1162,6 +1215,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1179,7 +1233,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1193,7 +1251,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def get_stats( @@ -1221,17 +1279,24 @@ def get_stats( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_stats_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_stats.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1246,7 +1311,7 @@ def get_stats( return deserialized - get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + get_stats.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore @distributed_trace @@ -1271,6 +1336,8 @@ def get_valid_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1283,6 +1350,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -1294,6 +1362,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1311,7 +1380,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1325,7 +1398,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + get_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore @distributed_trace def list_event_hub_consumer_groups( @@ -1354,6 +1427,8 @@ def list_event_hub_consumer_groups( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1367,6 +1442,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=self.list_event_hub_consumer_groups.metadata['url'], ) request = _convert_request(request) @@ -1379,6 +1455,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1396,7 +1473,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1410,7 +1491,7 @@ def get_next(next_link=None): 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 + list_event_hub_consumer_groups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore @distributed_trace def get_event_hub_consumer_group( @@ -1444,6 +1525,8 @@ def get_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1451,12 +1534,17 @@ def get_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.get_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1471,7 +1559,7 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + get_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -1506,6 +1594,8 @@ def create_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_create_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1513,12 +1603,17 @@ def create_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.create_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1533,11 +1628,11 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + create_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace - def delete_event_hub_consumer_group( + def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -1568,6 +1663,8 @@ def delete_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_delete_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1575,12 +1672,17 @@ def delete_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.delete_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1591,7 +1693,7 @@ def delete_event_hub_consumer_group( 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 + delete_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -1618,6 +1720,8 @@ def list_jobs( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1630,6 +1734,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_jobs.metadata['url'], ) request = _convert_request(request) @@ -1641,6 +1746,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1658,7 +1764,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1672,7 +1782,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + list_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore @distributed_trace def get_job( @@ -1705,18 +1815,25 @@ def get_job( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_job_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, job_id=job_id, + api_version=api_version, template_url=self.get_job.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1731,7 +1848,7 @@ def get_job( return deserialized - get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + get_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore @distributed_trace @@ -1756,6 +1873,8 @@ def get_quota_metrics( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1768,6 +1887,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_quota_metrics.metadata['url'], ) request = _convert_request(request) @@ -1779,6 +1899,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1796,7 +1917,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1810,12 +1935,14 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + get_quota_metrics.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore @distributed_trace def check_name_availability( self, operation_inputs: "_models.OperationInputs", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1825,6 +1952,9 @@ 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.v2016_02_03.models.OperationInputs + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo @@ -1836,12 +1966,13 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(operation_inputs, 'OperationInputs') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1849,7 +1980,11 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1864,7 +1999,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore @distributed_trace @@ -1891,6 +2026,8 @@ def list_keys( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1903,6 +2040,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -1914,6 +2052,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1931,7 +2070,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1945,7 +2088,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore @distributed_trace def get_keys_for_key_name( @@ -1978,18 +2121,25 @@ def get_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-02-03") # type: str + request = build_get_keys_for_key_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, key_name=key_name, + api_version=api_version, template_url=self.get_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2004,7 +2154,7 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + get_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore @distributed_trace @@ -2013,6 +2163,8 @@ def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob @@ -2029,6 +2181,9 @@ def export_devices( :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse @@ -2040,7 +2195,7 @@ def export_devices( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') @@ -2048,6 +2203,7 @@ def export_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.export_devices.metadata['url'], @@ -2055,7 +2211,11 @@ def export_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2070,7 +2230,7 @@ def export_devices( return deserialized - export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + export_devices.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore @distributed_trace @@ -2079,6 +2239,8 @@ def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For @@ -2095,6 +2257,9 @@ def import_devices( :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse @@ -2106,7 +2271,7 @@ def import_devices( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-03") # type: str _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') @@ -2114,6 +2279,7 @@ def import_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.import_devices.metadata['url'], @@ -2121,7 +2287,11 @@ def import_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2136,5 +2306,5 @@ def import_devices( return deserialized - import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore + 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/v2017_01_19/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py index c1ed12f768d0..65c0f29af71e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class IotHubClientConfiguration(Configuration): +class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotHubClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotHubClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-01-19". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-01-19" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) self._configure(**kwargs) 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 a2e342037f38..64015e06dcba 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import IotHubClientConfiguration @@ -30,8 +31,11 @@ class IotHubClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-01-19". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -55,7 +59,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 9b3b5dbac5c6..1a89fb51296f 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 @@ -10,8 +10,8 @@ "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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { 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 f30401ec2040..e5754a47ce68 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 = "2.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py index 6eb13e4cb392..f4683ba21af6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class IotHubClientConfiguration(Configuration): +class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotHubClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotHubClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-01-19". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-01-19" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) self._configure(**kwargs) 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 ce237e220a6e..6b14180c971b 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import IotHubClientConfiguration @@ -31,8 +32,11 @@ class IotHubClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-01-19". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ 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 2e28f6618b5a..88d4bbf00d97 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class IotHubResourceOperations: +class IotHubResourceOperations: # pylint: disable=too-many-public-methods """IotHubResourceOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -74,17 +73,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore async def _create_or_update_initial( @@ -115,6 +121,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(iot_hub_description, 'IotHubDescription') @@ -123,6 +130,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -130,7 +138,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -148,7 +160,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace_async @@ -187,8 +199,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -200,6 +213,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -224,10 +238,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore async def _delete_initial( self, @@ -241,17 +254,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -273,7 +293,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace_async @@ -306,7 +326,8 @@ async def begin_delete( ~azure.mgmt.iothub.v2017_01_19.models.ErrorDetails] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + 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', @@ -317,6 +338,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -340,10 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -361,6 +382,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -380,6 +404,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -397,7 +422,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,7 +440,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def list_by_resource_group( @@ -432,6 +461,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -443,6 +474,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -453,6 +485,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -470,7 +503,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,7 +521,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace_async async def get_stats( @@ -512,17 +549,24 @@ async def get_stats( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_stats_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_stats.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -537,7 +581,7 @@ async def get_stats( return deserialized - get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + get_stats.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore @distributed_trace @@ -562,6 +606,8 @@ def get_valid_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -574,6 +620,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -585,6 +632,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -602,7 +650,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -616,7 +668,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + get_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore @distributed_trace def list_event_hub_consumer_groups( @@ -645,6 +697,8 @@ def list_event_hub_consumer_groups( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -658,6 +712,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=self.list_event_hub_consumer_groups.metadata['url'], ) request = _convert_request(request) @@ -670,6 +725,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -687,7 +743,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -701,7 +761,7 @@ async def get_next(next_link=None): 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 + list_event_hub_consumer_groups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore @distributed_trace_async async def get_event_hub_consumer_group( @@ -735,6 +795,8 @@ async def get_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -742,12 +804,17 @@ async def get_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.get_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -762,7 +829,7 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + get_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace_async @@ -797,6 +864,8 @@ async def create_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_create_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -804,12 +873,17 @@ async def create_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.create_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -824,11 +898,11 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + create_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace_async - async def delete_event_hub_consumer_group( + async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -859,6 +933,8 @@ async def delete_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_delete_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -866,12 +942,17 @@ async def delete_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.delete_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -882,7 +963,7 @@ async def delete_event_hub_consumer_group( 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 + delete_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -909,6 +990,8 @@ def list_jobs( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -921,6 +1004,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_jobs.metadata['url'], ) request = _convert_request(request) @@ -932,6 +1016,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -949,7 +1034,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -963,7 +1052,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + list_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore @distributed_trace_async async def get_job( @@ -996,18 +1085,25 @@ async def get_job( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_job_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, job_id=job_id, + api_version=api_version, template_url=self.get_job.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1022,7 +1118,7 @@ async def get_job( return deserialized - get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + get_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore @distributed_trace @@ -1047,6 +1143,8 @@ def get_quota_metrics( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1059,6 +1157,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_quota_metrics.metadata['url'], ) request = _convert_request(request) @@ -1070,6 +1169,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1087,7 +1187,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1101,7 +1205,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + get_quota_metrics.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore @distributed_trace_async async def check_name_availability( @@ -1127,12 +1231,14 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(operation_inputs, 'OperationInputs') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1140,7 +1246,11 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1155,7 +1265,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore @distributed_trace @@ -1182,6 +1292,8 @@ def list_keys( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1194,6 +1306,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -1205,6 +1318,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1222,7 +1336,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1236,7 +1354,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore @distributed_trace_async async def get_keys_for_key_name( @@ -1269,18 +1387,25 @@ async def get_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_keys_for_key_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, key_name=key_name, + api_version=api_version, template_url=self.get_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1295,7 +1420,7 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + get_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore @distributed_trace_async @@ -1331,6 +1456,7 @@ async def export_devices( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') @@ -1339,6 +1465,7 @@ async def export_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.export_devices.metadata['url'], @@ -1346,7 +1473,11 @@ async def export_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1361,7 +1492,7 @@ async def export_devices( return deserialized - export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + export_devices.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore @distributed_trace_async @@ -1397,6 +1528,7 @@ async def import_devices( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') @@ -1405,6 +1537,7 @@ async def import_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.import_devices.metadata['url'], @@ -1412,7 +1545,11 @@ async def import_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1427,5 +1564,5 @@ async def import_devices( return deserialized - import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore + 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/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 9a3c7727f484..f43379beb5b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,31 +35,32 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,35 +74,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-01-19" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,31 +115,32 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -147,29 +149,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -179,30 +182,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -213,31 +217,32 @@ def build_get_stats_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -248,31 +253,32 @@ def build_get_valid_skus_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -284,10 +290,11 @@ def build_list_event_hub_consumer_groups_request( event_hub_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -295,21 +302,21 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -322,10 +329,11 @@ def build_get_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -334,21 +342,21 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -361,10 +369,11 @@ def build_create_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -373,21 +382,21 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -400,10 +409,11 @@ def build_delete_event_hub_consumer_group_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -412,21 +422,21 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -437,31 +447,32 @@ def build_list_jobs_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -473,10 +484,11 @@ def build_get_job_request( job_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -484,21 +496,21 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -509,31 +521,32 @@ def build_get_quota_metrics_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -545,33 +558,33 @@ def build_check_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-01-19" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -584,31 +597,32 @@ def build_list_keys_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -620,10 +634,11 @@ def build_get_keys_for_key_name_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-01-19" + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -631,21 +646,21 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -659,35 +674,35 @@ def build_export_devices_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-01-19" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -703,41 +718,41 @@ def build_import_devices_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-01-19" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class IotHubResourceOperations(object): +class IotHubResourceOperations(object): # pylint: disable=too-many-public-methods """IotHubResourceOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -785,17 +800,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,7 +832,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore def _create_or_update_initial( @@ -826,6 +848,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(iot_hub_description, 'IotHubDescription') @@ -834,6 +857,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -841,7 +865,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -859,7 +887,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace @@ -897,8 +925,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -910,6 +939,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -934,10 +964,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore def _delete_initial( self, @@ -951,17 +980,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -983,7 +1019,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace @@ -1015,7 +1051,8 @@ def begin_delete( or ~azure.mgmt.iothub.v2017_01_19.models.ErrorDetails] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + 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', @@ -1026,6 +1063,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1049,10 +1087,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -1070,6 +1107,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1080,6 +1119,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1089,6 +1129,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1106,7 +1147,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1120,7 +1165,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def list_by_resource_group( @@ -1141,6 +1186,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1152,6 +1199,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -1162,6 +1210,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1179,7 +1228,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1193,7 +1246,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore @distributed_trace def get_stats( @@ -1221,17 +1274,24 @@ def get_stats( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_stats_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_stats.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1246,7 +1306,7 @@ def get_stats( return deserialized - get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + get_stats.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore @distributed_trace @@ -1271,6 +1331,8 @@ def get_valid_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1283,6 +1345,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -1294,6 +1357,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1311,7 +1375,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1325,7 +1393,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + get_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore @distributed_trace def list_event_hub_consumer_groups( @@ -1354,6 +1422,8 @@ def list_event_hub_consumer_groups( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1367,6 +1437,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=self.list_event_hub_consumer_groups.metadata['url'], ) request = _convert_request(request) @@ -1379,6 +1450,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1396,7 +1468,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1410,7 +1486,7 @@ def get_next(next_link=None): 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 + list_event_hub_consumer_groups.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore @distributed_trace def get_event_hub_consumer_group( @@ -1444,6 +1520,8 @@ def get_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1451,12 +1529,17 @@ def get_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.get_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1471,7 +1554,7 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + get_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -1506,6 +1589,8 @@ def create_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_create_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1513,12 +1598,17 @@ def create_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.create_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1533,11 +1623,11 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + create_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace - def delete_event_hub_consumer_group( + def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -1568,6 +1658,8 @@ def delete_event_hub_consumer_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_delete_event_hub_consumer_group_request( subscription_id=self._config.subscription_id, @@ -1575,12 +1667,17 @@ def delete_event_hub_consumer_group( resource_name=resource_name, event_hub_endpoint_name=event_hub_endpoint_name, name=name, + api_version=api_version, template_url=self.delete_event_hub_consumer_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1591,7 +1688,7 @@ def delete_event_hub_consumer_group( 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 + delete_event_hub_consumer_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore @distributed_trace @@ -1618,6 +1715,8 @@ def list_jobs( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1630,6 +1729,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_jobs.metadata['url'], ) request = _convert_request(request) @@ -1641,6 +1741,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1658,7 +1759,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1672,7 +1777,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + list_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore @distributed_trace def get_job( @@ -1705,18 +1810,25 @@ def get_job( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_job_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, job_id=job_id, + api_version=api_version, template_url=self.get_job.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1731,7 +1843,7 @@ def get_job( return deserialized - get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + get_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore @distributed_trace @@ -1756,6 +1868,8 @@ def get_quota_metrics( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1768,6 +1882,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.get_quota_metrics.metadata['url'], ) request = _convert_request(request) @@ -1779,6 +1894,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1796,7 +1912,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1810,7 +1930,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + get_quota_metrics.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore @distributed_trace def check_name_availability( @@ -1836,12 +1956,14 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(operation_inputs, 'OperationInputs') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1849,7 +1971,11 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1864,7 +1990,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore @distributed_trace @@ -1891,6 +2017,8 @@ def list_keys( ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1903,6 +2031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -1914,6 +2043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1931,7 +2061,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1945,7 +2079,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore @distributed_trace def get_keys_for_key_name( @@ -1978,18 +2112,25 @@ def get_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str + request = build_get_keys_for_key_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, key_name=key_name, + api_version=api_version, template_url=self.get_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2004,7 +2145,7 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + get_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore @distributed_trace @@ -2040,6 +2181,7 @@ def export_devices( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') @@ -2048,6 +2190,7 @@ def export_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.export_devices.metadata['url'], @@ -2055,7 +2198,11 @@ def export_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2070,7 +2217,7 @@ def export_devices( return deserialized - export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + export_devices.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore @distributed_trace @@ -2106,6 +2253,7 @@ def import_devices( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-01-19") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') @@ -2114,6 +2262,7 @@ def import_devices( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.import_devices.metadata['url'], @@ -2121,7 +2270,11 @@ def import_devices( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2136,5 +2289,5 @@ def import_devices( return deserialized - import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore + 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/v2017_07_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py deleted file mode 100644 index 5ce009af8fd1..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2017-07-01" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 4414b0b4414f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2017_07_01.operations.IotHubResourceOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2017_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json deleted file mode 100644 index 5f98b61d4d1d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "chosen_version": "2017-07-01", - "total_api_version_list": ["2017-07-01"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "iot_hub_resource": "IotHubResourceOperations", - "certificates": "CertificatesOperations" - } -} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py deleted file mode 100644 index 40d8ab7b9521..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2017-07-01" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index bee6ec61f9b1..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py +++ /dev/null @@ -1,97 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2017_07_01.aio.operations.IotHubResourceOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2017_07_01/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py deleted file mode 100644 index 824bf6a80df3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 ._certificates_operations import CertificatesOperations - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index 4b86305ff88d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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.v2017_07_01.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index aba209624d8d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1438 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request -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.v2017_07_01.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2017_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 _delete_initial( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription or - ~azure.mgmt.iothub.v2017_07_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2017_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py deleted file mode 100644 index a0cc31207e31..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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.v2017_07_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/v2017_07_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py deleted file mode 100644 index 54511d29bce7..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py +++ /dev/null @@ -1,131 +0,0 @@ -# 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 ._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 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 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 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 MessagingEndpointProperties -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationInputs -from ._models_py3 import OperationListResult -from ._models_py3 import OperationsMonitoringProperties -from ._models_py3 import RegistryStatistics -from ._models_py3 import Resource -from ._models_py3 import RouteProperties -from ._models_py3 import RoutingEndpoints -from ._models_py3 import RoutingEventHubProperties -from ._models_py3 import RoutingProperties -from ._models_py3 import RoutingServiceBusQueueEndpointProperties -from ._models_py3 import RoutingServiceBusTopicEndpointProperties -from ._models_py3 import RoutingStorageContainerProperties -from ._models_py3 import SharedAccessSignatureAuthorizationRule -from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult -from ._models_py3 import StorageEndpointProperties - - -from ._iot_hub_client_enums import ( - AccessRights, - Capabilities, - IotHubNameUnavailabilityReason, - IotHubScaleType, - IotHubSku, - IotHubSkuTier, - IpFilterActionType, - JobStatus, - JobType, - OperationMonitoringLevel, - RoutingSource, -) - -__all__ = [ - 'CertificateBodyDescription', - 'CertificateDescription', - 'CertificateListDescription', - 'CertificateProperties', - 'CertificatePropertiesWithNonce', - 'CertificateVerificationDescription', - 'CertificateWithNonceDescription', - 'CloudToDeviceProperties', - 'ErrorDetails', - 'EventHubConsumerGroupInfo', - 'EventHubConsumerGroupsListResult', - 'EventHubProperties', - 'ExportDevicesRequest', - 'FallbackRouteProperties', - 'FeedbackProperties', - 'ImportDevicesRequest', - 'IotHubCapacity', - 'IotHubDescription', - 'IotHubDescriptionListResult', - 'IotHubNameAvailabilityInfo', - 'IotHubProperties', - 'IotHubQuotaMetricInfo', - 'IotHubQuotaMetricInfoListResult', - 'IotHubSkuDescription', - 'IotHubSkuDescriptionListResult', - 'IotHubSkuInfo', - 'IpFilterRule', - 'JobResponse', - 'JobResponseListResult', - 'MessagingEndpointProperties', - 'Operation', - 'OperationDisplay', - 'OperationInputs', - 'OperationListResult', - 'OperationsMonitoringProperties', - 'RegistryStatistics', - 'Resource', - 'RouteProperties', - 'RoutingEndpoints', - 'RoutingEventHubProperties', - 'RoutingProperties', - 'RoutingServiceBusQueueEndpointProperties', - 'RoutingServiceBusTopicEndpointProperties', - 'RoutingStorageContainerProperties', - 'SharedAccessSignatureAuthorizationRule', - 'SharedAccessSignatureAuthorizationRuleListResult', - 'StorageEndpointProperties', - 'AccessRights', - 'Capabilities', - 'IotHubNameUnavailabilityReason', - 'IotHubScaleType', - 'IotHubSku', - 'IotHubSkuTier', - 'IpFilterActionType', - 'JobStatus', - 'JobType', - 'OperationMonitoringLevel', - 'RoutingSource', -] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_iot_hub_client_enums.py deleted file mode 100644 index 8c8854d1a75a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,121 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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 IotHubNameUnavailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The reason for unavailability. - """ - - INVALID = "Invalid" - ALREADY_EXISTS = "AlreadyExists" - -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" - -class IotHubSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The billing tier for the IoT hub. - """ - - FREE = "Free" - STANDARD = "Standard" - -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 OperationMonitoringLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The operations monitoring level. - """ - - NONE = "None" - ERROR = "Error" - INFORMATION = "Information" - ERROR_INFORMATION = "Error, Information" - -class RoutingSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The source that the routing rule is to be applied to, such as DeviceMessages. - """ - - DEVICE_MESSAGES = "DeviceMessages" - TWIN_CHANGE_EVENTS = "TwinChangeEvents" - DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" - DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" 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 deleted file mode 100644 index dd94caccf791..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py +++ /dev/null @@ -1,2376 +0,0 @@ -# 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription] - """ - 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 - """ - - _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'}, - } - - 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 - - -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 - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'readonly': True}, - 'is_verified': {'readonly': True}, - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'verification_code': {'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'}, - } - - 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 - - -class CertificateVerificationDescription(msrest.serialization.Model): - """The JSON-serialized leaf certificate. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2017_07_01.models.FeedbackProperties - """ - 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 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. - - :ivar tags: A set of tags. The tags. - :vartype tags: 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 - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. The tags. - :paramtype tags: dict[str, str] - :keyword id: The Event Hub-compatible consumer group identifier. - :paramtype id: str - :keyword name: The Event Hub-compatible consumer group name. - :paramtype name: str - """ - super(EventHubConsumerGroupInfo, self).__init__(**kwargs) - self.tags = tags - self.id = id - 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. - - :ivar value: The array of Event Hub-compatible consumer group names. - :vartype value: list[str] - :ivar next_link: The next link. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword value: The array of Event Hub-compatible consumer group names. - :paramtype value: list[str] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - super(ExportDevicesRequest, self).__init__(**kwargs) - self.export_blob_container_uri = export_blob_container_uri - self.exclude_keys = exclude_keys - - -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. - - :ivar source: Required. The source to which the routing rule is to be applied to. For example, - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype is_enabled: bool - """ - - _validation = { - 'source': {'required': True}, - 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - '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, - condition: Optional[str] = None, - **kwargs - ): - """ - :keyword source: Required. The source to which the routing rule is to be applied to. For - example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - super(FallbackRouteProperties, self).__init__(**kwargs) - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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.v2017_07_01.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar subscriptionid: Required. The subscription identifier. - :vartype subscriptionid: str - :ivar resourcegroup: Required. The name of the resource group that contains the IoT hub. A - resource group name uniquely identifies the resource group within the subscription. - :vartype resourcegroup: str - :ivar 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. - :vartype etag: str - :ivar properties: The properties of an IoT hub. - :vartype properties: ~azure.mgmt.iothub.v2017_07_01.models.IotHubProperties - :ivar sku: Required. Information about the SKU of the IoT hub. - :vartype sku: ~azure.mgmt.iothub.v2017_07_01.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}, - 'subscriptionid': {'required': True}, - 'resourcegroup': {'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}'}, - 'subscriptionid': {'key': 'subscriptionid', 'type': 'str'}, - 'resourcegroup': {'key': 'resourcegroup', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, - 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, - } - - def __init__( - self, - *, - location: str, - subscriptionid: str, - resourcegroup: str, - sku: "IotHubSkuInfo", - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - properties: Optional["IotHubProperties"] = None, - **kwargs - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword subscriptionid: Required. The subscription identifier. - :paramtype subscriptionid: str - :keyword resourcegroup: Required. The name of the resource group that contains the IoT hub. A - resource group name uniquely identifies the resource group within the subscription. - :paramtype resourcegroup: str - :keyword 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. - :paramtype etag: str - :keyword properties: The properties of an IoT hub. - :paramtype properties: ~azure.mgmt.iothub.v2017_07_01.models.IotHubProperties - :keyword sku: Required. Information about the SKU of the IoT hub. - :paramtype sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo - """ - super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) - self.subscriptionid = subscriptionid - self.resourcegroup = resourcegroup - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] - """ - super(IotHubDescriptionListResult, self).__init__(**kwargs) - self.value = value - self.next_link = 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.v2017_07_01.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2017_07_01.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2017_07_01.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar operations_monitoring_properties: 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. - :vartype operations_monitoring_properties: - ~azure.mgmt.iothub.v2017_07_01.models.OperationsMonitoringProperties - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2017_07_01.models.Capabilities - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'host_name': {'readonly': True}, - } - - _attribute_map = { - 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, - 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, - 'provisioning_state': {'key': 'provisioningState', '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'}, - 'operations_monitoring_properties': {'key': 'operationsMonitoringProperties', 'type': 'OperationsMonitoringProperties'}, - 'features': {'key': 'features', 'type': 'str'}, - } - - 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, - operations_monitoring_properties: Optional["OperationsMonitoringProperties"] = None, - features: Optional[Union[str, "Capabilities"]] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2017_07_01.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2017_07_01.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2017_07_01.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2017_07_01.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword operations_monitoring_properties: 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. - :paramtype operations_monitoring_properties: - ~azure.mgmt.iothub.v2017_07_01.models.OperationsMonitoringProperties - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2017_07_01.models.Capabilities - """ - super(IotHubProperties, self).__init__(**kwargs) - self.authorization_policies = authorization_policies - self.ip_filter_rules = ip_filter_rules - self.provisioning_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.operations_monitoring_properties = operations_monitoring_properties - self.features = features - - -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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. Information about the SKU of the IoT hub. - :vartype sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo - :ivar capacity: Required. IoT Hub capacity information. - :vartype capacity: ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword sku: Required. Information about the SKU of the IoT hub. - :paramtype sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo - :keyword capacity: Required. IoT Hub capacity information. - :paramtype capacity: ~azure.mgmt.iothub.v2017_07_01.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :vartype 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.v2017_07_01.models.IotHubSkuTier - :ivar capacity: Required. The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype capacity: long - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'capacity': {'required': 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: int, - **kwargs - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :paramtype name: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSku - :keyword capacity: Required. The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2017_07_01.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2017_07_01.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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.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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2017_07_01.models.OperationDisplay - """ - 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 - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - - -class OperationInputs(msrest.serialization.Model): - """Input values. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'Name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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.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 - """ - - _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 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. - - :ivar events: Dictionary of :code:``. - :vartype events: dict[str, str or - ~azure.mgmt.iothub.v2017_07_01.models.OperationMonitoringLevel] - """ - - _attribute_map = { - 'events': {'key': 'events', 'type': '{str}'}, - } - - def __init__( - self, - *, - events: Optional[Dict[str, Union[str, "OperationMonitoringLevel"]]] = None, - **kwargs - ): - """ - :keyword events: Dictionary of :code:``. - :paramtype events: dict[str, str or - ~azure.mgmt.iothub.v2017_07_01.models.OperationMonitoringLevel] - """ - super(OperationsMonitoringProperties, self).__init__(**kwargs) - self.events = events - - -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 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2017_07_01.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2017_07_01.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2017_07_01.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - super(RoutingEventHubProperties, self).__init__(**kwargs) - self.connection_string = connection_string - self.name = name - self.subscription_id = subscription_id - self.resource_group = resource_group - - -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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2017_07_01.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2017_07_01.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2017_07_01.models.FallbackRouteProperties - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, - 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, - 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, - } - - def __init__( - self, - *, - endpoints: Optional["RoutingEndpoints"] = None, - routes: Optional[List["RouteProperties"]] = None, - fallback_route: Optional["FallbackRouteProperties"] = None, - **kwargs - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2017_07_01.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2017_07_01.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2017_07_01.models.FallbackRouteProperties - """ - super(RoutingProperties, self).__init__(**kwargs) - self.endpoints = endpoints - self.routes = routes - self.fallback_route = fallback_route - - -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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :vartype encoding: str - """ - - _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[str] = None, - **kwargs - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :paramtype encoding: str - """ - 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 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2017_07_01.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2017_07_01.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - super(StorageEndpointProperties, self).__init__(**kwargs) - self.sas_ttl_as_iso8601 = sas_ttl_as_iso8601 - self.connection_string = connection_string - self.container_name = container_name diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py deleted file mode 100644 index 824bf6a80df3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 ._certificates_operations import CertificatesOperations - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index 18cb73c3bed8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2017_07_01.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 91c889db3eb2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2150 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2017_07_01.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 _delete_initial( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription - or ~azure.mgmt.iothub.v2017_07_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2017_07_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2017_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2017_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py deleted file mode 100644 index 6c4cffa23041..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2017-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2017_07_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2017_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/v2017_07_01/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py deleted file mode 100644 index f55c34e1de97..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2018-01-22" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 68bffdac7958..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2018_01_22.operations.IotHubResourceOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2018_01_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json deleted file mode 100644 index e2500d28a681..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "chosen_version": "2018-01-22", - "total_api_version_list": ["2018-01-22"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "iot_hub_resource": "IotHubResourceOperations", - "certificates": "CertificatesOperations" - } -} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py deleted file mode 100644 index a3da587edd4f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2018-01-22" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index ea05376c5fae..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py +++ /dev/null @@ -1,97 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2018_01_22.aio.operations.IotHubResourceOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2018_01_22/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py deleted file mode 100644 index 824bf6a80df3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 ._certificates_operations import CertificatesOperations - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index ee30cb4164b2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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.v2018_01_22.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 6326463e758e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1557 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_update_request_initial -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.v2018_01_22.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2018_01_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2018_01_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription or - ~azure.mgmt.iothub.v2018_01_22.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_01_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py deleted file mode 100644 index a0f3e84a084b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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.v2018_01_22.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/v2018_01_22/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py deleted file mode 100644 index 30257e59af2f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py +++ /dev/null @@ -1,133 +0,0 @@ -# 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 ._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 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 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 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 MessagingEndpointProperties -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationInputs -from ._models_py3 import OperationListResult -from ._models_py3 import OperationsMonitoringProperties -from ._models_py3 import RegistryStatistics -from ._models_py3 import Resource -from ._models_py3 import RouteProperties -from ._models_py3 import RoutingEndpoints -from ._models_py3 import RoutingEventHubProperties -from ._models_py3 import RoutingProperties -from ._models_py3 import RoutingServiceBusQueueEndpointProperties -from ._models_py3 import RoutingServiceBusTopicEndpointProperties -from ._models_py3 import RoutingStorageContainerProperties -from ._models_py3 import SharedAccessSignatureAuthorizationRule -from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult -from ._models_py3 import StorageEndpointProperties -from ._models_py3 import TagsResource - - -from ._iot_hub_client_enums import ( - AccessRights, - Capabilities, - IotHubNameUnavailabilityReason, - IotHubScaleType, - IotHubSku, - IotHubSkuTier, - IpFilterActionType, - JobStatus, - JobType, - OperationMonitoringLevel, - RoutingSource, -) - -__all__ = [ - 'CertificateBodyDescription', - 'CertificateDescription', - 'CertificateListDescription', - 'CertificateProperties', - 'CertificatePropertiesWithNonce', - 'CertificateVerificationDescription', - 'CertificateWithNonceDescription', - 'CloudToDeviceProperties', - 'ErrorDetails', - 'EventHubConsumerGroupInfo', - 'EventHubConsumerGroupsListResult', - 'EventHubProperties', - 'ExportDevicesRequest', - 'FallbackRouteProperties', - 'FeedbackProperties', - 'ImportDevicesRequest', - 'IotHubCapacity', - 'IotHubDescription', - 'IotHubDescriptionListResult', - 'IotHubNameAvailabilityInfo', - 'IotHubProperties', - 'IotHubQuotaMetricInfo', - 'IotHubQuotaMetricInfoListResult', - 'IotHubSkuDescription', - 'IotHubSkuDescriptionListResult', - 'IotHubSkuInfo', - 'IpFilterRule', - 'JobResponse', - 'JobResponseListResult', - 'MessagingEndpointProperties', - 'Operation', - 'OperationDisplay', - 'OperationInputs', - 'OperationListResult', - 'OperationsMonitoringProperties', - 'RegistryStatistics', - 'Resource', - 'RouteProperties', - 'RoutingEndpoints', - 'RoutingEventHubProperties', - 'RoutingProperties', - 'RoutingServiceBusQueueEndpointProperties', - 'RoutingServiceBusTopicEndpointProperties', - 'RoutingStorageContainerProperties', - 'SharedAccessSignatureAuthorizationRule', - 'SharedAccessSignatureAuthorizationRuleListResult', - 'StorageEndpointProperties', - 'TagsResource', - 'AccessRights', - 'Capabilities', - 'IotHubNameUnavailabilityReason', - 'IotHubScaleType', - 'IotHubSku', - 'IotHubSkuTier', - 'IpFilterActionType', - 'JobStatus', - 'JobType', - 'OperationMonitoringLevel', - 'RoutingSource', -] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_iot_hub_client_enums.py deleted file mode 100644 index 8c8854d1a75a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,121 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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 IotHubNameUnavailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The reason for unavailability. - """ - - INVALID = "Invalid" - ALREADY_EXISTS = "AlreadyExists" - -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" - -class IotHubSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The billing tier for the IoT hub. - """ - - FREE = "Free" - STANDARD = "Standard" - -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 OperationMonitoringLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The operations monitoring level. - """ - - NONE = "None" - ERROR = "Error" - INFORMATION = "Information" - ERROR_INFORMATION = "Error, Information" - -class RoutingSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The source that the routing rule is to be applied to, such as DeviceMessages. - """ - - DEVICE_MESSAGES = "DeviceMessages" - TWIN_CHANGE_EVENTS = "TwinChangeEvents" - DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" - DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" 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 deleted file mode 100644 index b3c1a0c63993..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py +++ /dev/null @@ -1,2407 +0,0 @@ -# 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription] - """ - 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 - """ - - _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'}, - } - - 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 - - -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 - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'readonly': True}, - 'is_verified': {'readonly': True}, - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'verification_code': {'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'}, - } - - 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 - - -class CertificateVerificationDescription(msrest.serialization.Model): - """The JSON-serialized leaf certificate. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2018_01_22.models.FeedbackProperties - """ - 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 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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - super(ExportDevicesRequest, self).__init__(**kwargs) - self.export_blob_container_uri = export_blob_container_uri - self.exclude_keys = exclude_keys - - -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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source to which the routing rule is to be applied to. For example, - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source to which the routing rule is to be applied to. For - example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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.v2018_01_22.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: The properties of an IoT hub. - :vartype properties: ~azure.mgmt.iothub.v2018_01_22.models.IotHubProperties - :ivar sku: Required. Information about the SKU of the IoT hub. - :vartype sku: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: The properties of an IoT hub. - :paramtype properties: ~azure.mgmt.iothub.v2018_01_22.models.IotHubProperties - :keyword sku: Required. Information about the SKU of the IoT hub. - :paramtype sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] - """ - super(IotHubDescriptionListResult, self).__init__(**kwargs) - self.value = value - self.next_link = 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.v2018_01_22.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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. - :vartype state: str - :ivar host_name: The name of the host. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2018_01_22.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2018_01_22.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar operations_monitoring_properties: 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. - :vartype operations_monitoring_properties: - ~azure.mgmt.iothub.v2018_01_22.models.OperationsMonitoringProperties - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2018_01_22.models.Capabilities - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'host_name': {'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'}, - 'operations_monitoring_properties': {'key': 'operationsMonitoringProperties', 'type': 'OperationsMonitoringProperties'}, - 'features': {'key': 'features', 'type': 'str'}, - } - - 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, - operations_monitoring_properties: Optional["OperationsMonitoringProperties"] = None, - features: Optional[Union[str, "Capabilities"]] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2018_01_22.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2018_01_22.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_01_22.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2018_01_22.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword operations_monitoring_properties: 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. - :paramtype operations_monitoring_properties: - ~azure.mgmt.iothub.v2018_01_22.models.OperationsMonitoringProperties - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2018_01_22.models.Capabilities - """ - 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.operations_monitoring_properties = operations_monitoring_properties - self.features = features - - -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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo - :ivar capacity: Required. IoT Hub capacity information. - :vartype capacity: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo - :keyword capacity: Required. IoT Hub capacity information. - :paramtype capacity: ~azure.mgmt.iothub.v2018_01_22.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :vartype 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.v2018_01_22.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :paramtype name: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2018_01_22.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2018_01_22.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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.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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2018_01_22.models.OperationDisplay - """ - 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 - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - - -class OperationInputs(msrest.serialization.Model): - """Input values. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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.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 - """ - - _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 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. - - :ivar events: Dictionary of :code:``. - :vartype events: dict[str, str or - ~azure.mgmt.iothub.v2018_01_22.models.OperationMonitoringLevel] - """ - - _attribute_map = { - 'events': {'key': 'events', 'type': '{str}'}, - } - - def __init__( - self, - *, - events: Optional[Dict[str, Union[str, "OperationMonitoringLevel"]]] = None, - **kwargs - ): - """ - :keyword events: Dictionary of :code:``. - :paramtype events: dict[str, str or - ~azure.mgmt.iothub.v2018_01_22.models.OperationMonitoringLevel] - """ - super(OperationsMonitoringProperties, self).__init__(**kwargs) - self.events = events - - -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 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2018_01_22.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2018_01_22.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2018_01_22.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - super(RoutingEventHubProperties, self).__init__(**kwargs) - self.connection_string = connection_string - self.name = name - self.subscription_id = subscription_id - self.resource_group = resource_group - - -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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2018_01_22.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2018_01_22.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2018_01_22.models.FallbackRouteProperties - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, - 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, - 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, - } - - def __init__( - self, - *, - endpoints: Optional["RoutingEndpoints"] = None, - routes: Optional[List["RouteProperties"]] = None, - fallback_route: Optional["FallbackRouteProperties"] = None, - **kwargs - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2018_01_22.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2018_01_22.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2018_01_22.models.FallbackRouteProperties - """ - super(RoutingProperties, self).__init__(**kwargs) - self.endpoints = endpoints - self.routes = routes - self.fallback_route = fallback_route - - -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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :vartype encoding: str - """ - - _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[str] = None, - **kwargs - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :paramtype encoding: str - """ - 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 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2018_01_22.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2018_01_22.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py deleted file mode 100644 index 824bf6a80df3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 ._certificates_operations import CertificatesOperations - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index 0ff51fe8a7db..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2018_01_22.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index c563c9fa4cbe..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2312 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2018_01_22.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription - or ~azure.mgmt.iothub.v2018_01_22.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2018_01_22.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_01_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_01_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py deleted file mode 100644 index b03fd6ba6885..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2018-01-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2018_01_22.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2018_01_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/v2018_01_22/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py deleted file mode 100644 index b769e14330dc..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2018-04-01" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 90c47669ff17..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py +++ /dev/null @@ -1,103 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2018_04_01.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2018_04_01.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2018_04_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json deleted file mode 100644 index 77f57a51f86f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "chosen_version": "2018-04-01", - "total_api_version_list": ["2018-04-01"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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" - } -} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py deleted file mode 100644 index 33025dfbeb4b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2018-04-01" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index e6b9814e84cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2018_04_01.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2018_04_01.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2018_04_01/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py deleted file mode 100644 index 68f403afba22..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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 - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'ResourceProviderCommonOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index b49828f49c8b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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.v2018_04_01.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index cc101dda0373..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1759 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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.v2018_04_01.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2018_04_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2018_04_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription or - ~azure.mgmt.iothub.v2018_04_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_04_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py deleted file mode 100644 index dafdb8c83729..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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.v2018_04_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/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 deleted file mode 100644 index b13bd6e0238b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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.v2018_04_01.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_04_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py deleted file mode 100644 index ab7ebbb14918..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py +++ /dev/null @@ -1,173 +0,0 @@ -# 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 ._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 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 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 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 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 OperationsMonitoringProperties -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 - - -from ._iot_hub_client_enums import ( - AccessRights, - Capabilities, - EndpointHealthStatus, - IotHubNameUnavailabilityReason, - IotHubScaleType, - IotHubSku, - IotHubSkuTier, - IpFilterActionType, - JobStatus, - JobType, - OperationMonitoringLevel, - RouteErrorSeverity, - RoutingSource, - TestResultStatus, -) - -__all__ = [ - 'CertificateBodyDescription', - 'CertificateDescription', - 'CertificateListDescription', - 'CertificateProperties', - 'CertificatePropertiesWithNonce', - 'CertificateVerificationDescription', - 'CertificateWithNonceDescription', - 'CloudToDeviceProperties', - 'EndpointHealthData', - 'EndpointHealthDataListResult', - 'ErrorDetails', - 'EventHubConsumerGroupInfo', - 'EventHubConsumerGroupsListResult', - 'EventHubProperties', - 'ExportDevicesRequest', - 'FallbackRouteProperties', - 'FeedbackProperties', - 'ImportDevicesRequest', - 'IotHubCapacity', - 'IotHubDescription', - 'IotHubDescriptionListResult', - 'IotHubNameAvailabilityInfo', - 'IotHubProperties', - 'IotHubQuotaMetricInfo', - 'IotHubQuotaMetricInfoListResult', - 'IotHubSkuDescription', - 'IotHubSkuDescriptionListResult', - 'IotHubSkuInfo', - 'IpFilterRule', - 'JobResponse', - 'JobResponseListResult', - 'MatchedRoute', - 'MessagingEndpointProperties', - 'Name', - 'Operation', - 'OperationDisplay', - 'OperationInputs', - 'OperationListResult', - 'OperationsMonitoringProperties', - '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', - 'IotHubScaleType', - 'IotHubSku', - 'IotHubSkuTier', - 'IpFilterActionType', - 'JobStatus', - 'JobType', - 'OperationMonitoringLevel', - 'RouteErrorSeverity', - 'RoutingSource', - 'TestResultStatus', -] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_iot_hub_client_enums.py deleted file mode 100644 index 0ee5551a863e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,150 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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)): - """The health status code of the 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 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 OperationMonitoringLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The operations monitoring level. - """ - - NONE = "None" - ERROR = "Error" - INFORMATION = "Information" - ERROR_INFORMATION = "Error, Information" - -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" - -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/v2018_04_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py deleted file mode 100644 index 234c3d982d55..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py +++ /dev/null @@ -1,3020 +0,0 @@ -# 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 Any, 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2018_04_01.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar health_status: The health status code of the endpoint. Possible values include: - "unknown", "healthy", "unhealthy", "dead". - :vartype health_status: str or ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword health_status: The health status code of the endpoint. Possible values include: - "unknown", "healthy", "unhealthy", "dead". - :paramtype health_status: str or ~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthStatus - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthData] - """ - super(EndpointHealthDataListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - super(ExportDevicesRequest, self).__init__(**kwargs) - self.export_blob_container_uri = export_blob_container_uri - self.exclude_keys = exclude_keys - - -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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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.v2018_04_01.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2018_04_01.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] - """ - super(IotHubDescriptionListResult, self).__init__(**kwargs) - self.value = value - self.next_link = 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.v2018_04_01.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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. - :vartype state: str - :ivar host_name: The name of the host. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2018_04_01.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2018_04_01.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar operations_monitoring_properties: 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. - :vartype operations_monitoring_properties: - ~azure.mgmt.iothub.v2018_04_01.models.OperationsMonitoringProperties - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2018_04_01.models.Capabilities - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'host_name': {'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'}, - 'operations_monitoring_properties': {'key': 'operationsMonitoringProperties', 'type': 'OperationsMonitoringProperties'}, - 'features': {'key': 'features', 'type': 'str'}, - } - - 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, - operations_monitoring_properties: Optional["OperationsMonitoringProperties"] = None, - features: Optional[Union[str, "Capabilities"]] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2018_04_01.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2018_04_01.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2018_04_01.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2018_04_01.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword operations_monitoring_properties: 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. - :paramtype operations_monitoring_properties: - ~azure.mgmt.iothub.v2018_04_01.models.OperationsMonitoringProperties - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2018_04_01.models.Capabilities - """ - 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.operations_monitoring_properties = operations_monitoring_properties - self.features = features - - -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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2018_04_01.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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.v2018_04_01.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2018_04_01.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2018_04_01.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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.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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2018_04_01.models.OperationDisplay - """ - 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 - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - - -class OperationInputs(msrest.serialization.Model): - """Input values. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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.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 - """ - - _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 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. - - :ivar events: Dictionary of :code:``. - :vartype events: dict[str, str or - ~azure.mgmt.iothub.v2018_04_01.models.OperationMonitoringLevel] - """ - - _attribute_map = { - 'events': {'key': 'events', 'type': '{str}'}, - } - - def __init__( - self, - *, - events: Optional[Dict[str, Union[str, "OperationMonitoringLevel"]]] = None, - **kwargs - ): - """ - :keyword events: Dictionary of :code:``. - :paramtype events: dict[str, str or - ~azure.mgmt.iothub.v2018_04_01.models.OperationMonitoringLevel] - """ - super(OperationsMonitoringProperties, self).__init__(**kwargs) - self.events = events - - -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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2018_04_01.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2018_04_01.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2018_04_01.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2018_04_01.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2018_04_01.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2018_04_01.models.FallbackRouteProperties - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, - 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, - 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, - } - - def __init__( - self, - *, - endpoints: Optional["RoutingEndpoints"] = None, - routes: Optional[List["RouteProperties"]] = None, - fallback_route: Optional["FallbackRouteProperties"] = None, - **kwargs - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2018_04_01.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2018_04_01.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2018_04_01.models.FallbackRouteProperties - """ - super(RoutingProperties, self).__init__(**kwargs) - self.endpoints = endpoints - self.routes = routes - self.fallback_route = fallback_route - - -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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need - not be the same as the actual queue name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. The name - need not be the same as the actual topic name. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :vartype encoding: str - """ - - _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[str] = None, - **kwargs - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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, operationsMonitoringEvents, - fileNotifications, $default. Endpoint names must be unique across endpoint types. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword encoding: Encoding that is used to serialize messages to blobs. Supported values are - 'avro' and 'avroDeflate'. Default value is 'avro'. - :paramtype encoding: str - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired_properties: Twin desired properties. - :vartype desired_properties: any - :ivar reported_properties: Twin desired properties. - :vartype reported_properties: any - """ - - _attribute_map = { - 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, - 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, - } - - def __init__( - self, - *, - desired_properties: Optional[Any] = None, - reported_properties: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired_properties: Twin desired properties. - :paramtype desired_properties: any - :keyword reported_properties: Twin desired properties. - :paramtype reported_properties: any - """ - super(RoutingTwinProperties, self).__init__(**kwargs) - self.desired_properties = desired_properties - self.reported_properties = reported_properties - - -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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2018_04_01.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2018_04_01.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2018_04_01.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2018_04_01.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2018_04_01.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2018_04_01.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2018_04_01.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2018_04_01.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2018_04_01.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py deleted file mode 100644 index 68f403afba22..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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 - -__all__ = [ - 'Operations', - 'IotHubResourceOperations', - 'ResourceProviderCommonOperations', - 'CertificatesOperations', -] 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 deleted file mode 100644 index e16b781d11e8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2018_04_01.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 0a8da21cedb0..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2637 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2018_04_01.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription - or ~azure.mgmt.iothub.v2018_04_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2018_04_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_04_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py deleted file mode 100644 index 52cd6c72b4e2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2018_04_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2018_04_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/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 deleted file mode 100644 index 6ba5aff172f3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-04-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2018_04_01.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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.v2018_04_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2018_04_01/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py deleted file mode 100644 index cd5c63745cf2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-03-22" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 951b3ca1b38b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py +++ /dev/null @@ -1,106 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2019_03_22.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2019_03_22.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2019_03_22.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_03_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json deleted file mode 100644 index fc5e51cb66cb..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "chosen_version": "2019-03-22", - "total_api_version_list": ["2019-03-22"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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_03_22/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py deleted file mode 100644 index 3bae35d63381..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-03-22" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index a782c8bcf8e1..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py +++ /dev/null @@ -1,104 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2019_03_22.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2019_03_22.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2019_03_22.aio.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_03_22/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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_03_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py deleted file mode 100644 index 2fb6cf7150c3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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_03_22.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_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 deleted file mode 100644 index d3da730ab3cd..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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_03_22.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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_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 deleted file mode 100644 index 76472d2e0237..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1759 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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_03_22.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_03_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_03_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription or - ~azure.mgmt.iothub.v2019_03_22.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_03_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py deleted file mode 100644 index f28df237f22e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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_03_22.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_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 deleted file mode 100644 index 01f77bcf4b4a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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_03_22.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_03_22/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py deleted file mode 100644 index db0d9c0ada4a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py +++ /dev/null @@ -1,177 +0,0 @@ -# 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 ._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 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 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 - - -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', - 'ErrorDetails', - 'EventHubConsumerGroupInfo', - 'EventHubConsumerGroupsListResult', - 'EventHubProperties', - 'ExportDevicesRequest', - 'FailoverInput', - 'FallbackRouteProperties', - 'FeedbackProperties', - 'ImportDevicesRequest', - 'IotHubCapacity', - 'IotHubDescription', - 'IotHubDescriptionListResult', - 'IotHubLocationDescription', - 'IotHubNameAvailabilityInfo', - 'IotHubProperties', - '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_03_22/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_iot_hub_client_enums.py deleted file mode 100644 index 19ff62f5aabe..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,167 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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)): - """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 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" - -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_03_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py deleted file mode 100644 index 3b9699b9de18..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py +++ /dev/null @@ -1,3077 +0,0 @@ -# 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 Any, 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2019_03_22.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthStatus - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthData] - """ - super(EndpointHealthDataListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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_03_22.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2019_03_22.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype role: str or ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubReplicaRoleType - """ - 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_03_22.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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. - :vartype state: str - :ivar host_name: The name of the host. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2019_03_22.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2019_03_22.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype 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.v2019_03_22.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'}, - '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, - features: Optional[Union[str, "Capabilities"]] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2019_03_22.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2019_03_22.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_03_22.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2019_03_22.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2019_03_22.models.Capabilities - """ - 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.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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2019_03_22.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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.v2019_03_22.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2019_03_22.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2019_03_22.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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_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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2019_03_22.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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_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 - """ - - _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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2019_03_22.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2019_03_22.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2019_03_22.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2019_03_22.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2019_03_22.models.FallbackRouteProperties - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, - 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, - 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, - } - - def __init__( - self, - *, - endpoints: Optional["RoutingEndpoints"] = None, - routes: Optional[List["RouteProperties"]] = None, - fallback_route: Optional["FallbackRouteProperties"] = None, - **kwargs - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2019_03_22.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2019_03_22.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2019_03_22.models.FallbackRouteProperties - """ - super(RoutingProperties, self).__init__(**kwargs) - self.endpoints = endpoints - self.routes = routes - self.fallback_route = fallback_route - - -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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype encoding: str or - ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2019_03_22.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2019_03_22.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2019_03_22.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2019_03_22.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2019_03_22.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2019_03_22.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2019_03_22.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2019_03_22.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2019_03_22.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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_03_22/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py deleted file mode 100644 index 4dcff655b801..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_03_22.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_03_22/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py deleted file mode 100644 index 5b443b3b4450..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_03_22.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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_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 deleted file mode 100644 index 586341a29d20..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2637 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_03_22.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription - or ~azure.mgmt.iothub.v2019_03_22.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_03_22.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_03_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py deleted file mode 100644 index 1e4a39cc4c0a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_03_22.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_03_22.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_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 deleted file mode 100644 index 38666fafa756..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-03-22" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_03_22.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_03_22.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_03_22/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file 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 deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index 4d73b23ea30a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = ARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 9cdd0e184440..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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 deleted file mode 100644 index 6ca10e975b29..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "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.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" 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 deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index 03687e3c970b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = AsyncARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 554abd2a2516..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py +++ /dev/null @@ -1,105 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file 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 deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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 deleted file mode 100644 index 4f0c10b2d5fe..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,426 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 057b2134e253..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 deleted file mode 100644 index ef121d2789ad..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1761 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription - or ~azure.mgmt.iothub.v2019_07_01_preview.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 8e1fd34f8682..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index 083b5a669602..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 837cba04f503..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py +++ /dev/null @@ -1,181 +0,0 @@ -# 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 ._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 - - -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 deleted file mode 100644 index 618c9a456b12..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,166 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py deleted file mode 100644 index c37f85003c33..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py +++ /dev/null @@ -1,3180 +0,0 @@ -# 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 Any, 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype 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 - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: - ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype 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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2019_07_01_preview.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype 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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or - ~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthStatus - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype 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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype 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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype 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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] - """ - 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. - - :ivar location: Azure Geo Regions. - :vartype location: str - :ivar role: Specific Role assigned to this location. Possible values include: "primary", - "secondary". - :vartype 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 - ): - """ - :keyword location: Azure Geo Regions. - :paramtype location: str - :keyword role: Specific Role assigned to this location. Possible values include: "primary", - "secondary". - :paramtype role: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubReplicaRoleType - """ - 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 - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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 - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2019_07_01_preview.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar device_streams: The device streams properties of iothub. - :vartype device_streams: - ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubPropertiesDeviceStreams - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype 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 - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_07_01_preview.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: - ~azure.mgmt.iothub.v2019_07_01_preview.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword device_streams: The device streams properties of iothub. - :paramtype device_streams: - ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubPropertiesDeviceStreams - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.Capabilities - """ - 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. - - :ivar streaming_endpoints: List of Device Streams Endpoints. - :vartype streaming_endpoints: list[str] - """ - - _attribute_map = { - 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, - } - - def __init__( - self, - *, - streaming_endpoints: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword streaming_endpoints: List of Device Streams Endpoints. - :paramtype streaming_endpoints: list[str] - """ - 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. - - :ivar value: The array of quota metrics objects. - :vartype 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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype 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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype 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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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 - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar value: The array of JobResponse objects. - :vartype 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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype 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 - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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 - :ivar display: The object that represents the operation. - :vartype 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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype 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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype 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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype 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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2019_07_01_preview.models.FallbackRouteProperties - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: - ~azure.mgmt.iothub.v2019_07_01_preview.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.EnrichmentProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype 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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype 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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DigitalTwinChangeEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DigitalTwinChangeEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype 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 - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype 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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype 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 - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype 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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2019_07_01_preview.models.Name - """ - 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. - - :ivar value: - :vartype 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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuota] - """ - 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 deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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 deleted file mode 100644 index b82824c8f721..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,678 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 79e771d2eeed..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py +++ /dev/null @@ -1,204 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 deleted file mode 100644 index c5727624509f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2642 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription - or ~azure.mgmt.iothub.v2019_07_01_preview.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 56922073a5b9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py +++ /dev/null @@ -1,136 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index 858af7aef515..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-07-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# 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/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py deleted file mode 100644 index db44b6c2402a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-11-04" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index badc2a2e1a2a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py +++ /dev/null @@ -1,106 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2019_11_04.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2019_11_04.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2019_11_04.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_11_04/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json deleted file mode 100644 index 82012676da9a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "chosen_version": "2019-11-04", - "total_api_version_list": ["2019-11-04"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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_11_04/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py deleted file mode 100644 index e98f39e76d91..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-11-04" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 49300465af52..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py +++ /dev/null @@ -1,104 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2019_11_04.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2019_11_04.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2019_11_04.aio.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_11_04/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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_11_04/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py deleted file mode 100644 index 9a317c7b66c5..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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_11_04.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_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 deleted file mode 100644 index 28b9b1639fb5..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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_11_04.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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_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 deleted file mode 100644 index 868faa55009c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1759 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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_11_04.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_11_04.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_11_04.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription or - ~azure.mgmt.iothub.v2019_11_04.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_11_04/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py deleted file mode 100644 index 37fce809b96d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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_11_04.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_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 deleted file mode 100644 index 47037cc33390..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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_11_04.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_11_04/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py deleted file mode 100644 index e49548abc8de..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py +++ /dev/null @@ -1,179 +0,0 @@ -# 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 ._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 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 - - -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', - '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_11_04/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_iot_hub_client_enums.py deleted file mode 100644 index 19ff62f5aabe..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,167 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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)): - """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 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" - -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_11_04/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py deleted file mode 100644 index b243979335c6..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py +++ /dev/null @@ -1,3136 +0,0 @@ -# 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 Any, 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2019_11_04.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthStatus - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - """ - 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_11_04.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2019_11_04.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype role: str or ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubReplicaRoleType - """ - 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_11_04.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] - :ivar ip_filter_rules: The IP filter rules. - :vartype 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. - :vartype state: str - :ivar host_name: The name of the host. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2019_11_04.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2019_11_04.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype 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.v2019_11_04.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'}, - '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, - features: Optional[Union[str, "Capabilities"]] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2019_11_04.models.IpFilterRule] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2019_11_04.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2019_11_04.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2019_11_04.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2019_11_04.models.Capabilities - """ - 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.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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2019_11_04.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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.v2019_11_04.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2019_11_04.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2019_11_04.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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_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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2019_11_04.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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_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 - """ - - _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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2019_11_04.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2019_11_04.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2019_11_04.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2019_11_04.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2019_11_04.models.FallbackRouteProperties - :ivar 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. - :vartype enrichments: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2019_11_04.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2019_11_04.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2019_11_04.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: list[~azure.mgmt.iothub.v2019_11_04.models.EnrichmentProperties] - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword connection_string: Required. The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar connection_string: Required. The connection string of the storage account. - :vartype connection_string: str - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype encoding: str or - ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword connection_string: Required. The connection string of the storage account. - :paramtype connection_string: str - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2019_11_04.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2019_11_04.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2019_11_04.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2019_11_04.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2019_11_04.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2019_11_04.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2019_11_04.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2019_11_04.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2019_11_04.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py deleted file mode 100644 index b95fca917d02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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_11_04/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py deleted file mode 100644 index 2871159c0bb3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_11_04.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_11_04/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py deleted file mode 100644 index 61395d0c12e6..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_11_04.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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_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 deleted file mode 100644 index 8891bb2c035c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2637 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_11_04.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription - or ~azure.mgmt.iothub.v2019_11_04.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2019_11_04.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_11_04/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py deleted file mode 100644 index c2d3f2296a2a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_11_04.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_11_04.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_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 deleted file mode 100644 index 3492dcfa293d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2019-11-04" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_11_04.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_11_04.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_11_04/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py deleted file mode 100644 index ef82a2d7b619..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2020-03-01" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index 729a6be2075b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2020_03_01.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2020_03_01.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2020_03_01.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.v2020_03_01.operations.IotHubOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :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.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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2020_03_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json deleted file mode 100644 index 7263b5339a8a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "chosen_version": "2020-03-01", - "total_api_version_list": ["2020-03-01"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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/v2020_03_01/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py deleted file mode 100644 index 7a90522e2bd9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2020-03-01" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 deleted file mode 100644 index e7d55bb480c2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: 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.v2020_03_01.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2020_03_01.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2020_03_01.aio.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :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.v2020_03_01.aio.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/v2020_03_01/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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/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 deleted file mode 100644 index d486ba04638a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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.v2020_03_01.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 24c42a56e959..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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.v2020_03_01.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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/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 deleted file mode 100644 index ae18200a4a3e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1759 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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.v2020_03_01.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2020_03_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2020_03_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription or - ~azure.mgmt.iothub.v2020_03_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2020_03_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py deleted file mode 100644 index 7e6d9a095008..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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.v2020_03_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/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 deleted file mode 100644 index 6301e9371f09..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -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.v2020_03_01.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2020_03_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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.v2020_03_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/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 deleted file mode 100644 index 87ecc58767bc..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_request -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.v2020_03_01.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index b98fdb828dd9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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.v2020_03_01.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2020_03_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py deleted file mode 100644 index 154f2039f5a6..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py +++ /dev/null @@ -1,199 +0,0 @@ -# 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 ._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 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 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 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 - - -from ._iot_hub_client_enums import ( - AccessRights, - AuthenticationType, - Capabilities, - EndpointHealthStatus, - IotHubNameUnavailabilityReason, - IotHubReplicaRoleType, - IotHubScaleType, - IotHubSku, - IotHubSkuTier, - IpFilterActionType, - JobStatus, - JobType, - PrivateLinkServiceConnectionStatus, - PublicNetworkAccess, - RouteErrorSeverity, - RoutingSource, - RoutingStorageContainerPropertiesEncoding, - TestResultStatus, -) - -__all__ = [ - 'CertificateBodyDescription', - 'CertificateDescription', - 'CertificateListDescription', - 'CertificateProperties', - 'CertificatePropertiesWithNonce', - 'CertificateVerificationDescription', - 'CertificateWithNonceDescription', - 'CloudToDeviceProperties', - 'EndpointHealthData', - 'EndpointHealthDataListResult', - 'EnrichmentProperties', - 'ErrorDetails', - 'EventHubConsumerGroupInfo', - 'EventHubConsumerGroupsListResult', - 'EventHubProperties', - 'ExportDevicesRequest', - 'FailoverInput', - 'FallbackRouteProperties', - 'FeedbackProperties', - 'GroupIdInformation', - 'GroupIdInformationProperties', - 'ImportDevicesRequest', - 'IotHubCapacity', - 'IotHubDescription', - 'IotHubDescriptionListResult', - 'IotHubLocationDescription', - 'IotHubNameAvailabilityInfo', - 'IotHubProperties', - 'IotHubQuotaMetricInfo', - 'IotHubQuotaMetricInfoListResult', - 'IotHubSkuDescription', - 'IotHubSkuDescriptionListResult', - 'IotHubSkuInfo', - 'IpFilterRule', - 'JobResponse', - 'JobResponseListResult', - 'MatchedRoute', - 'MessagingEndpointProperties', - 'Name', - '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', - 'EndpointHealthStatus', - 'IotHubNameUnavailabilityReason', - 'IotHubReplicaRoleType', - 'IotHubScaleType', - 'IotHubSku', - 'IotHubSkuTier', - 'IpFilterActionType', - 'JobStatus', - 'JobType', - 'PrivateLinkServiceConnectionStatus', - 'PublicNetworkAccess', - 'RouteErrorSeverity', - 'RoutingSource', - 'RoutingStorageContainerPropertiesEncoding', - 'TestResultStatus', -] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_iot_hub_client_enums.py deleted file mode 100644 index 44f1adadad66..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,190 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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 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)): - """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 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 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" - -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/v2020_03_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py deleted file mode 100644 index f8e30068d236..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py +++ /dev/null @@ -1,3613 +0,0 @@ -# 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 Any, 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2020_03_01.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthStatus - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype exclude_keys: bool - :ivar 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. - :vartype export_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - - _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'}, - } - - def __init__( - self, - *, - export_blob_container_uri: str, - exclude_keys: bool, - export_blob_name: Optional[str] = None, - authentication_type: Optional[Union[str, "AuthenticationType"]] = None, - **kwargs - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - :keyword 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. - :paramtype export_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - 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 - - -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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 - :ivar properties: Required. The properties for a group information object. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword properties: Required. The properties for a group information object. - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformationProperties - """ - 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. - - :ivar group_id: The group id. - :vartype group_id: str - :ivar required_members: The required members for a specific group id. - :vartype required_members: list[str] - :ivar required_zone_names: The required DNS zones for a specific group id. - :vartype 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 - ): - """ - :keyword group_id: The group id. - :paramtype group_id: str - :keyword required_members: The required members for a specific group id. - :paramtype required_members: list[str] - :keyword required_zone_names: The required DNS zones for a specific group id. - :paramtype required_zone_names: list[str] - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype output_blob_container_uri: str - :ivar input_blob_name: The blob name to be used when importing from the provided input blob - container. - :vartype input_blob_name: str - :ivar output_blob_name: The blob name to use for storing the status of the import job. - :vartype output_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - - _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'}, - } - - 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, - **kwargs - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - :keyword input_blob_name: The blob name to be used when importing from the provided input blob - container. - :paramtype input_blob_name: str - :keyword output_blob_name: The blob name to use for storing the status of the import job. - :paramtype output_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - 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 - - -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.v2020_03_01.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype role: str or ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubReplicaRoleType - """ - 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.v2020_03_01.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.iothub.v2020_03_01.models.PublicNetworkAccess - :ivar ip_filter_rules: The IP filter rules. - :vartype ip_filter_rules: list[~azure.mgmt.iothub.v2020_03_01.models.IpFilterRule] - :ivar 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. - :vartype min_tls_version: str - :ivar private_endpoint_connections: Private endpoint connections created on this IotHub. - :vartype 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. - :vartype state: str - :ivar host_name: The name of the host. - :vartype host_name: str - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2020_03_01.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2020_03_01.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype 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.v2020_03_01.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]'}, - '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, - 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 - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.iothub.v2020_03_01.models.PublicNetworkAccess - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2020_03_01.models.IpFilterRule] - :keyword 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. - :paramtype min_tls_version: str - :keyword private_endpoint_connections: Private endpoint connections created on this IotHub. - :paramtype private_endpoint_connections: - list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2020_03_01.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2020_03_01.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2020_03_01.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2020_03_01.models.Capabilities - """ - 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.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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2020_03_01.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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.v2020_03_01.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2020_03_01.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2020_03_01.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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.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.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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2020_03_01.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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.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 - """ - - _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 - :ivar properties: Required. The properties of a private endpoint connection. - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword properties: Required. The properties of a private endpoint connection. - :paramtype properties: - ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnectionProperties - """ - 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. - - :ivar private_endpoint: The private endpoint property of a private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpoint - :ivar private_link_service_connection_state: Required. The current state of a private endpoint - connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword private_endpoint: The private endpoint property of a private endpoint connection. - :paramtype private_endpoint: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpoint - :keyword private_link_service_connection_state: Required. The current state of a private - endpoint connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionState - """ - 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. - - :ivar value: The list of available private link resources for an IotHub. - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, - } - - def __init__( - self, - *, - value: Optional[List["GroupIdInformation"]] = None, - **kwargs - ): - """ - :keyword value: The list of available private link resources for an IotHub. - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation] - """ - 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. - - :ivar status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :vartype status: str or - ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionStatus - :ivar description: Required. The description for the current state of a private endpoint - connection. - :vartype description: str - :ivar actions_required: Actions required for a private endpoint connection. - :vartype 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 - ): - """ - :keyword status: Required. The status of a private endpoint connection. Possible values - include: "Pending", "Approved", "Rejected", "Disconnected". - :paramtype status: str or - ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionStatus - :keyword description: Required. The description for the current state of a private endpoint - connection. - :paramtype description: str - :keyword actions_required: Actions required for a private endpoint connection. - :paramtype actions_required: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword source: Required. The source that the routing rule is to be applied to, such as - DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", - "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2020_03_01.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2020_03_01.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar id: Id of the event hub endpoint. - :vartype id: str - :ivar connection_string: The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :vartype endpoint_uri: str - :ivar entity_path: Event hub name on the event hub namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the event hub endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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'}, - '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, - subscription_id: Optional[str] = None, - resource_group: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the event hub endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Event hub name on the event hub namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the event hub endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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.name = name - self.subscription_id = subscription_id - self.resource_group = resource_group - - -class RoutingMessage(msrest.serialization.Model): - """Routing message. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2020_03_01.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2020_03_01.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2020_03_01.models.FallbackRouteProperties - :ivar 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. - :vartype enrichments: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2020_03_01.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2020_03_01.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2020_03_01.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: list[~azure.mgmt.iothub.v2020_03_01.models.EnrichmentProperties] - """ - 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. - - :ivar id: Id of the service bus queue endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus queue endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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'}, - '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, - subscription_id: Optional[str] = None, - resource_group: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the service bus queue endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus queue - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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.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. - - :ivar id: Id of the service bus topic endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus topic. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus topic endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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'}, - '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, - subscription_id: Optional[str] = None, - resource_group: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the service bus topic endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus topic. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus topic - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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.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. - - :ivar id: Id of the storage container endpoint. - :vartype id: str - :ivar connection_string: The connection string of the storage account. - :vartype connection_string: str - :ivar endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :vartype endpoint_uri: str - :ivar authentication_type: Method used to authenticate against the storage endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype encoding: str or - ~azure.mgmt.iothub.v2020_03_01.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'}, - '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, - 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 - ): - """ - :keyword id: Id of the storage container endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the storage account. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :paramtype endpoint_uri: str - :keyword authentication_type: Method used to authenticate against the storage endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerPropertiesEncoding - """ - super(RoutingStorageContainerProperties, self).__init__(**kwargs) - self.id = id - self.connection_string = connection_string - self.endpoint_uri = endpoint_uri - self.authentication_type = authentication_type - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2020_03_01.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype container_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - - _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'}, - } - - def __init__( - self, - *, - connection_string: str, - container_name: str, - sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - authentication_type: Optional[Union[str, "AuthenticationType"]] = None, - **kwargs - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType - """ - 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 - - -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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2020_03_01.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2020_03_01.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2020_03_01.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2020_03_01.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2020_03_01.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2020_03_01.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2020_03_01.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2020_03_01.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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/v2020_03_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py deleted file mode 100644 index a7ea4e625cfd..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 3558c1d9573b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2020_03_01.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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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/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 deleted file mode 100644 index b197c51cfc67..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2637 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription - or ~azure.mgmt.iothub.v2020_03_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def create_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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.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.v2020_03_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2020_03_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py deleted file mode 100644 index 505155cfd60b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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/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 deleted file mode 100644 index ade8c39c7b02..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,565 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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.v2020_03_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :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, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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/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 deleted file mode 100644 index d4327dfb078a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/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 deleted file mode 100644 index 5511313d433e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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.v2020_03_01.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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.v2020_03_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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/v2020_03_01/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file 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 deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index 4c19507767b9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = ARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 228c19ee302c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py +++ /dev/null @@ -1,115 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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 deleted file mode 100644 index 89c74400d8bf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "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.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" 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 deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index 8c2881ceb63e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = AsyncARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 0a2596c56ef8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py +++ /dev/null @@ -1,113 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file 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 deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index ae289fc0cd12..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,426 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index fab7afcbc92c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 deleted file mode 100644 index 9aa4244ff357..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1768 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription - or ~azure.mgmt.iothub.v2021_03_03_preview.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 7fe0153d081c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index 360476c9c1e9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 deleted file mode 100644 index 4ec5d7fa9f28..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_request -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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index f7e828fb0140..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 61dab75c6643..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py +++ /dev/null @@ -1,225 +0,0 @@ -# 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 ._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 - - -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 deleted file mode 100644 index a8c0e3a0f3e6..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,217 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py deleted file mode 100644 index 15e24f718b19..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py +++ /dev/null @@ -1,4112 +0,0 @@ -# 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 Any, 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 - :ivar 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". - :vartype type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.ResourceIdentityType - :ivar user_assigned_identities: Dictionary of :code:``. - :vartype 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 - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.ResourceIdentityType - :keyword user_assigned_identities: Dictionary of :code:``. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmUserIdentity] - """ - 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype 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 - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: - ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype 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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2021_03_03_preview.models.FeedbackProperties - """ - 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. - - :ivar key_source: The source of the key. - :vartype key_source: str - :ivar key_vault_properties: The properties of the KeyVault key. - :vartype 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 - ): - """ - :keyword key_source: The source of the key. - :paramtype key_source: str - :keyword key_vault_properties: The properties of the KeyVault key. - :paramtype key_vault_properties: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.KeyVaultKeyProperties] - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthStatus - :ivar last_known_error: Last error obtained when a message failed to be delivered to iot hub. - :vartype last_known_error: str - :ivar last_known_error_time: Time at which the last known error occurred. - :vartype last_known_error_time: ~datetime.datetime - :ivar last_successful_send_attempt_time: Last time iot hub successfully sent a message to the - endpoint. - :vartype last_successful_send_attempt_time: ~datetime.datetime - :ivar last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :vartype 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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthStatus - :keyword last_known_error: Last error obtained when a message failed to be delivered to iot - hub. - :paramtype last_known_error: str - :keyword last_known_error_time: Time at which the last known error occurred. - :paramtype last_known_error_time: ~datetime.datetime - :keyword last_successful_send_attempt_time: Last time iot hub successfully sent a message to - the endpoint. - :paramtype last_successful_send_attempt_time: ~datetime.datetime - :keyword last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :paramtype last_send_attempt_time: ~datetime.datetime - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype 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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: The EventHub consumer group name. - :vartype 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 - ): - """ - :keyword properties: The EventHub consumer group name. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupName - """ - 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. - - :ivar properties: The tags. - :vartype 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 - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, str] - """ - 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. - - :ivar name: EventHub consumer group name. - :vartype name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: EventHub consumer group name. - :paramtype name: str - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype 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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype exclude_keys: bool - :ivar 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. - :vartype export_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for export devices. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - :keyword 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. - :paramtype export_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for export devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 - :ivar properties: Required. The properties for a group information object. - :vartype 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 - ): - """ - :keyword properties: Required. The properties for a group information object. - :paramtype properties: - ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformationProperties - """ - 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. - - :ivar group_id: The group id. - :vartype group_id: str - :ivar required_members: The required members for a specific group id. - :vartype required_members: list[str] - :ivar required_zone_names: The required DNS zones for a specific group id. - :vartype 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 - ): - """ - :keyword group_id: The group id. - :paramtype group_id: str - :keyword required_members: The required members for a specific group id. - :paramtype required_members: list[str] - :keyword required_zone_names: The required DNS zones for a specific group id. - :paramtype required_zone_names: list[str] - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype output_blob_container_uri: str - :ivar input_blob_name: The blob name to be used when importing from the provided input blob - container. - :vartype input_blob_name: str - :ivar output_blob_name: The blob name to use for storing the status of the import job. - :vartype output_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for import devices. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - :keyword input_blob_name: The blob name to be used when importing from the provided input blob - container. - :paramtype input_blob_name: str - :keyword output_blob_name: The blob name to use for storing the status of the import job. - :paramtype output_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for import devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo - :ivar identity: The managed identities for the IotHub. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo - :keyword identity: The managed identities for the IotHub. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmIdentity - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype 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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype 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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubReplicaRoleType - """ - 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 - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.PublicNetworkAccess - :ivar ip_filter_rules: The IP filter rules. - :vartype ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterRule] - :ivar network_rule_sets: Network Rule Set Properties of IotHub. - :vartype network_rule_sets: - ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetProperties - :ivar 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. - :vartype min_tls_version: str - :ivar private_endpoint_connections: Private endpoint connections created on this IotHub. - :vartype 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 - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2021_03_03_preview.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar device_streams: The device streams properties of iothub. - :vartype device_streams: - ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubPropertiesDeviceStreams - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.Capabilities - :ivar encryption: The encryption properties for the IoT hub. - :vartype 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 - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.PublicNetworkAccess - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterRule] - :keyword network_rule_sets: Network Rule Set Properties of IotHub. - :paramtype network_rule_sets: - ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetProperties - :keyword 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. - :paramtype min_tls_version: str - :keyword private_endpoint_connections: Private endpoint connections created on this IotHub. - :paramtype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_03_preview.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: - ~azure.mgmt.iothub.v2021_03_03_preview.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword device_streams: The device streams properties of iothub. - :paramtype device_streams: - ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubPropertiesDeviceStreams - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.Capabilities - :keyword encryption: The encryption properties for the IoT hub. - :paramtype encryption: - ~azure.mgmt.iothub.v2021_03_03_preview.models.EncryptionPropertiesDescription - """ - 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. - - :ivar streaming_endpoints: List of Device Streams Endpoints. - :vartype streaming_endpoints: list[str] - """ - - _attribute_map = { - 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, - } - - def __init__( - self, - *, - streaming_endpoints: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword streaming_endpoints: List of Device Streams Endpoints. - :paramtype streaming_endpoints: list[str] - """ - 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. - - :ivar value: The array of quota metrics objects. - :vartype 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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype 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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype 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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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 - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar value: The array of JobResponse objects. - :vartype 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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class KeyVaultKeyProperties(msrest.serialization.Model): - """The properties of the KeyVault key. - - :ivar key_identifier: The identifier of the key. - :vartype key_identifier: str - :ivar identity: Managed identity properties of KeyVault Key. - :vartype 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 - ): - """ - :keyword key_identifier: The identifier of the key. - :paramtype key_identifier: str - :keyword identity: Managed identity properties of KeyVault Key. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - """ - super(KeyVaultKeyProperties, self).__init__(**kwargs) - self.key_identifier = key_identifier - self.identity = identity - - -class ManagedIdentity(msrest.serialization.Model): - """The properties of the Managed identity. - - :ivar user_assigned_identity: The user assigned identity. - :vartype user_assigned_identity: str - """ - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): - """ - :keyword user_assigned_identity: The user assigned identity. - :paramtype user_assigned_identity: str - """ - super(ManagedIdentity, self).__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype 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 - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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. - - :ivar filter_name: Required. Name of the IP filter rule. - :vartype filter_name: str - :ivar action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :vartype action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleIPAction - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. Name of the IP filter rule. - :paramtype filter_name: str - :keyword action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :paramtype action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleIPAction - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :vartype default_action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.DefaultAction - :ivar apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :vartype apply_to_built_in_event_hub_endpoint: bool - :ivar ip_rules: Required. List of IP Rules. - :vartype 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 - ): - """ - :keyword default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :paramtype default_action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.DefaultAction - :keyword apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :paramtype apply_to_built_in_event_hub_endpoint: bool - :keyword ip_rules: Required. List of IP Rules. - :paramtype ip_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetIpRule] - """ - 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 - :ivar display: The object that represents the operation. - :vartype 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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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 - :ivar properties: Required. The properties of a private endpoint connection. - :vartype 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 - ): - """ - :keyword properties: Required. The properties of a private endpoint connection. - :paramtype properties: - ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnectionProperties - """ - 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. - - :ivar private_endpoint: The private endpoint property of a private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpoint - :ivar private_link_service_connection_state: Required. The current state of a private endpoint - connection. - :vartype 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 - ): - """ - :keyword private_endpoint: The private endpoint property of a private endpoint connection. - :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpoint - :keyword private_link_service_connection_state: Required. The current state of a private - endpoint connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionState - """ - 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. - - :ivar value: The list of available private link resources for an IotHub. - :vartype 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 - ): - """ - :keyword value: The list of available private link resources for an IotHub. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation] - """ - 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. - - :ivar status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :vartype status: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionStatus - :ivar description: Required. The description for the current state of a private endpoint - connection. - :vartype description: str - :ivar actions_required: Actions required for a private endpoint connection. - :vartype 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 - ): - """ - :keyword status: Required. The status of a private endpoint connection. Possible values - include: "Pending", "Approved", "Rejected", "Disconnected". - :paramtype status: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionStatus - :keyword description: Required. The description for the current state of a private endpoint - connection. - :paramtype description: str - :keyword actions_required: Actions required for a private endpoint connection. - :paramtype actions_required: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype 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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype 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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype 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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar id: Id of the event hub endpoint. - :vartype id: str - :ivar connection_string: The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :vartype endpoint_uri: str - :ivar entity_path: Event hub name on the event hub namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the event hub endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of routing event hub endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the event hub endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Event hub name on the event hub namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the event hub endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of routing event hub endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2021_03_03_preview.models.FallbackRouteProperties - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: - ~azure.mgmt.iothub.v2021_03_03_preview.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.EnrichmentProperties] - """ - 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. - - :ivar id: Id of the service bus queue endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus queue endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus queue endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus queue endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus queue - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus queue endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the service bus topic endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus topic. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus topic endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus topic endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus topic endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus topic. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus topic - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus topic endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the storage container endpoint. - :vartype id: str - :ivar connection_string: The connection string of the storage account. - :vartype connection_string: str - :ivar endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :vartype endpoint_uri: str - :ivar authentication_type: Method used to authenticate against the storage endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of routing storage endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype 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 - ): - """ - :keyword id: Id of the storage container endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the storage account. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :paramtype endpoint_uri: str - :keyword authentication_type: Method used to authenticate against the storage endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of routing storage endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype 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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype 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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype container_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for file upload. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or - ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for file upload. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DigitalTwinChangeEvents", "DeviceConnectionStateEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DigitalTwinChangeEvents", "DeviceConnectionStateEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype 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 - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype 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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype 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 - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype 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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2021_03_03_preview.models.Name - """ - 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. - - :ivar value: - :vartype 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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuota] - """ - 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 deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index 3c50b0af35aa..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,678 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 9027f3dc07d6..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 deleted file mode 100644 index 73b364e5d2f0..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2658 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription - or ~azure.mgmt.iothub.v2021_03_03_preview.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 3b53a4a8082f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py +++ /dev/null @@ -1,136 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index 985b8c5e89fb..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,565 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 deleted file mode 100644 index b1dfa28d9017..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 632c02b4bc72..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-03-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# 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 deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index eb8e4bf8ef86..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = ARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 07f2dfe8d808..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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 deleted file mode 100644 index 6f4f713265df..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "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.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) 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 deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" 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 deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() 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 deleted file mode 100644 index 90a1a20ea65b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - 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 = AsyncARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 26297068135e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file 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 deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index 2990117af7a5..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 40b24473ac2d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 deleted file mode 100644 index ed5c7b17ad3b..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1768 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription or - ~azure.mgmt.iothub.v2021_03_31.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index f4569de4cc99..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index 1ee1881b03f4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 deleted file mode 100644 index 3f630cd628b3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_request -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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 43c59958ef8d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 138c7dde883f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py +++ /dev/null @@ -1,219 +0,0 @@ -# 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 ._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 - - -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 deleted file mode 100644 index 9f70b1792da9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,216 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py deleted file mode 100644 index 8552a0ed37ae..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py +++ /dev/null @@ -1,4016 +0,0 @@ -# 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 Any, 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 - :ivar 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". - :vartype type: str or ~azure.mgmt.iothub.v2021_03_31.models.ResourceIdentityType - :ivar user_assigned_identities: Dictionary of :code:``. - :vartype 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 - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.iothub.v2021_03_31.models.ResourceIdentityType - :keyword user_assigned_identities: Dictionary of :code:``. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.ArmUserIdentity] - """ - 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype 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 - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription] - """ - 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 - :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}, - } - - _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 - ): - """ - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype 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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype 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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2021_03_31.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthStatus - :ivar last_known_error: Last error obtained when a message failed to be delivered to iot hub. - :vartype last_known_error: str - :ivar last_known_error_time: Time at which the last known error occurred. - :vartype last_known_error_time: ~datetime.datetime - :ivar last_successful_send_attempt_time: Last time iot hub successfully sent a message to the - endpoint. - :vartype last_successful_send_attempt_time: ~datetime.datetime - :ivar last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :vartype 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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthStatus - :keyword last_known_error: Last error obtained when a message failed to be delivered to iot - hub. - :paramtype last_known_error: str - :keyword last_known_error_time: Time at which the last known error occurred. - :paramtype last_known_error_time: ~datetime.datetime - :keyword last_successful_send_attempt_time: Last time iot hub successfully sent a message to - the endpoint. - :paramtype last_successful_send_attempt_time: ~datetime.datetime - :keyword last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :paramtype last_send_attempt_time: ~datetime.datetime - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype 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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: Required. The EventHub consumer group name. - :vartype 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 - ): - """ - :keyword properties: Required. The EventHub consumer group name. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupName - """ - 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. - - :ivar properties: The tags. - :vartype properties: dict[str, any] - :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, Any]] = None, - **kwargs - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, any] - """ - 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. - - :ivar name: Required. EventHub consumer group name. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. EventHub consumer group name. - :paramtype name: str - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype 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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype exclude_keys: bool - :ivar 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. - :vartype export_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for export devices. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be exported. - :vartype include_configurations: bool - :ivar 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. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - :keyword 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. - :paramtype export_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for export devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - exported. - :paramtype include_configurations: bool - :keyword 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. - :paramtype configurations_blob_name: str - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 - :ivar properties: Required. The properties for a group information object. - :vartype 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 - ): - """ - :keyword properties: Required. The properties for a group information object. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformationProperties - """ - 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. - - :ivar group_id: The group id. - :vartype group_id: str - :ivar required_members: The required members for a specific group id. - :vartype required_members: list[str] - :ivar required_zone_names: The required DNS zones for a specific group id. - :vartype 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 - ): - """ - :keyword group_id: The group id. - :paramtype group_id: str - :keyword required_members: The required members for a specific group id. - :paramtype required_members: list[str] - :keyword required_zone_names: The required DNS zones for a specific group id. - :paramtype required_zone_names: list[str] - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype output_blob_container_uri: str - :ivar input_blob_name: The blob name to be used when importing from the provided input blob - container. - :vartype input_blob_name: str - :ivar output_blob_name: The blob name to use for storing the status of the import job. - :vartype output_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for import devices. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be imported. - :vartype include_configurations: bool - :ivar configurations_blob_name: The blob name to be used when importing configurations from the - provided input blob container. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - :keyword input_blob_name: The blob name to be used when importing from the provided input blob - container. - :paramtype input_blob_name: str - :keyword output_blob_name: The blob name to use for storing the status of the import job. - :paramtype output_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for import devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - imported. - :paramtype include_configurations: bool - :keyword configurations_blob_name: The blob name to be used when importing configurations from - the provided input blob container. - :paramtype configurations_blob_name: str - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2021_03_31.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo - :ivar identity: The managed identities for the IotHub. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo - :keyword identity: The managed identities for the IotHub. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ArmIdentity - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype 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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype 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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubReplicaRoleType - """ - 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 - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.iothub.v2021_03_31.models.PublicNetworkAccess - :ivar ip_filter_rules: The IP filter rules. - :vartype ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_31.models.IpFilterRule] - :ivar network_rule_sets: Network Rule Set Properties of IotHub. - :vartype network_rule_sets: ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetProperties - :ivar 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. - :vartype min_tls_version: str - :ivar private_endpoint_connections: Private endpoint connections created on this IotHub. - :vartype 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 - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2021_03_31.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2021_03_31.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype 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 - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.iothub.v2021_03_31.models.PublicNetworkAccess - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_31.models.IpFilterRule] - :keyword network_rule_sets: Network Rule Set Properties of IotHub. - :paramtype network_rule_sets: ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetProperties - :keyword 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. - :paramtype min_tls_version: str - :keyword private_endpoint_connections: Private endpoint connections created on this IotHub. - :paramtype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2021_03_31.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_03_31.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2021_03_31.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2021_03_31.models.Capabilities - """ - 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. - - :ivar value: The array of quota metrics objects. - :vartype 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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype 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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2021_03_31.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype 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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype 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 - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2021_03_31.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2021_03_31.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar value: The array of JobResponse objects. - :vartype 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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class ManagedIdentity(msrest.serialization.Model): - """The properties of the Managed identity. - - :ivar user_assigned_identity: The user assigned identity. - :vartype user_assigned_identity: str - """ - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): - """ - :keyword user_assigned_identity: The user assigned identity. - :paramtype user_assigned_identity: str - """ - super(ManagedIdentity, self).__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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. - - :ivar filter_name: Required. Name of the IP filter rule. - :vartype filter_name: str - :ivar action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :vartype action: str or ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleIPAction - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. Name of the IP filter rule. - :paramtype filter_name: str - :keyword action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :paramtype action: str or ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleIPAction - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :vartype default_action: str or ~azure.mgmt.iothub.v2021_03_31.models.DefaultAction - :ivar apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :vartype apply_to_built_in_event_hub_endpoint: bool - :ivar ip_rules: Required. List of IP Rules. - :vartype 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 - ): - """ - :keyword default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :paramtype default_action: str or ~azure.mgmt.iothub.v2021_03_31.models.DefaultAction - :keyword apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :paramtype apply_to_built_in_event_hub_endpoint: bool - :keyword ip_rules: Required. List of IP Rules. - :paramtype ip_rules: list[~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetIpRule] - """ - 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 - :ivar display: The object that represents the operation. - :vartype 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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2021_03_31.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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 - :ivar properties: Required. The properties of a private endpoint connection. - :vartype 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 - ): - """ - :keyword properties: Required. The properties of a private endpoint connection. - :paramtype properties: - ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnectionProperties - """ - 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. - - :ivar private_endpoint: The private endpoint property of a private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpoint - :ivar private_link_service_connection_state: Required. The current state of a private endpoint - connection. - :vartype 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 - ): - """ - :keyword private_endpoint: The private endpoint property of a private endpoint connection. - :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpoint - :keyword private_link_service_connection_state: Required. The current state of a private - endpoint connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionState - """ - 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. - - :ivar value: The list of available private link resources for an IotHub. - :vartype 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 - ): - """ - :keyword value: The list of available private link resources for an IotHub. - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation] - """ - 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. - - :ivar status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :vartype status: str or - ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionStatus - :ivar description: Required. The description for the current state of a private endpoint - connection. - :vartype description: str - :ivar actions_required: Actions required for a private endpoint connection. - :vartype 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 - ): - """ - :keyword status: Required. The status of a private endpoint connection. Possible values - include: "Pending", "Approved", "Rejected", "Disconnected". - :paramtype status: str or - ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionStatus - :keyword description: Required. The description for the current state of a private endpoint - connection. - :paramtype description: str - :keyword actions_required: Actions required for a private endpoint connection. - :paramtype actions_required: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype 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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype 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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2021_03_31.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype 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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2021_03_31.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar id: Id of the event hub endpoint. - :vartype id: str - :ivar connection_string: The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :vartype endpoint_uri: str - :ivar entity_path: Event hub name on the event hub namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the event hub endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of routing event hub endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the event hub endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Event hub name on the event hub namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the event hub endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of routing event hub endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2021_03_31.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2021_03_31.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2021_03_31.models.FallbackRouteProperties - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2021_03_31.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2021_03_31.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2021_03_31.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: list[~azure.mgmt.iothub.v2021_03_31.models.EnrichmentProperties] - """ - 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. - - :ivar id: Id of the service bus queue endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus queue endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus queue endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus queue endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus queue - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus queue endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the service bus topic endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus topic. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus topic endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus topic endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus topic endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus topic. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus topic - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus topic endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the storage container endpoint. - :vartype id: str - :ivar connection_string: The connection string of the storage account. - :vartype connection_string: str - :ivar endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :vartype endpoint_uri: str - :ivar authentication_type: Method used to authenticate against the storage endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of routing storage endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype 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 - ): - """ - :keyword id: Id of the storage container endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the storage account. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :paramtype endpoint_uri: str - :keyword authentication_type: Method used to authenticate against the storage endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of routing storage endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype 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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2021_03_31.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype 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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype container_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for file upload. - :vartype 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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for file upload. - :paramtype identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype 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 - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2021_03_31.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype 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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2021_03_31.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype 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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2021_03_31.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype 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 - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2021_03_31.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype 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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2021_03_31.models.Name - """ - 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. - - :ivar value: - :vartype 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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuota] - """ - 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 deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index a63605265f24..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 7a246268e179..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 deleted file mode 100644 index a13d67f3a4d4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2655 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription - or ~azure.mgmt.iothub.v2021_03_31.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index b9655bb17722..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 deleted file mode 100644 index c89a3fa451e1..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,565 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either 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, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 deleted file mode 100644 index e1cb8e6e05ae..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index 342b58062354..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-03-31" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py deleted file mode 100644 index 73456830f012..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-07-01" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py deleted file mode 100644 index 2808835450c2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.v2021_07_01.operations.Operations - :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.v2021_07_01.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2021_07_01.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2021_07_01.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.v2021_07_01.operations.IotHubOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.iothub.v2021_07_01.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.iothub.v2021_07_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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json deleted file mode 100644 index bfae722cc4d2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "chosen_version": "2021-07-01", - "total_api_version_list": ["2021-07-01"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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_07_01/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py deleted file mode 100644 index 749606420966..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-07-01" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py deleted file mode 100644 index 8f17427a881d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.v2021_07_01.aio.operations.Operations - :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: - azure.mgmt.iothub.v2021_07_01.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2021_07_01.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2021_07_01.aio.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.v2021_07_01.aio.operations.IotHubOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.iothub.v2021_07_01.aio.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.iothub.v2021_07_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. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_07_01/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py deleted file mode 100644 index 86d212e2ad00..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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_07_01.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_07_01.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_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py deleted file mode 100644 index 09e4828d3b27..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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_07_01.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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py deleted file mode 100644 index 0c0227544837..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1768 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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_07_01.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription or - ~azure.mgmt.iothub.v2021_07_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_07_01.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_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_07_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_07_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py deleted file mode 100644 index 810279931319..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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_07_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 7bfb227702fe..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -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_07_01.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_07_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index 2969ebe9ef94..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_request -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_07_01.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py deleted file mode 100644 index cecb59652ea7..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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_07_01.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py deleted file mode 100644 index 138c7dde883f..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py +++ /dev/null @@ -1,219 +0,0 @@ -# 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 ._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 - - -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_07_01/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py deleted file mode 100644 index 9f70b1792da9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,216 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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_07_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py deleted file mode 100644 index 095997944480..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py +++ /dev/null @@ -1,4072 +0,0 @@ -# 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 Any, 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 - :ivar 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". - :vartype type: str or ~azure.mgmt.iothub.v2021_07_01.models.ResourceIdentityType - :ivar user_assigned_identities: Dictionary of :code:``. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.iothub.v2021_07_01.models.ResourceIdentityType - :keyword user_assigned_identities: Dictionary of :code:``. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.ArmUserIdentity] - """ - 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - :ivar is_verified: True indicates that the certificate will be created in verified state and - proof of possession will not be required. - :vartype is_verified: bool - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - is_verified: Optional[bool] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - :keyword is_verified: True indicates that the certificate will be created in verified state and - proof of possession will not be required. - :paramtype is_verified: bool - """ - super(CertificateBodyDescription, self).__init__(**kwargs) - self.certificate = certificate - self.is_verified = is_verified - - -class CertificateDescription(msrest.serialization.Model): - """The X509 Certificate. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription] - """ - 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 - :ivar certificate: The certificate content. - :vartype certificate: str - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'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, - *, - is_verified: Optional[bool] = None, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword is_verified: Determines whether certificate has been verified. - :paramtype is_verified: bool - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - super(CertificateProperties, self).__init__(**kwargs) - self.subject = None - self.expiry = None - self.thumbprint = None - self.is_verified = is_verified - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2021_07_01.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthStatus - :ivar last_known_error: Last error obtained when a message failed to be delivered to iot hub. - :vartype last_known_error: str - :ivar last_known_error_time: Time at which the last known error occurred. - :vartype last_known_error_time: ~datetime.datetime - :ivar last_successful_send_attempt_time: Last time iot hub successfully sent a message to the - endpoint. - :vartype last_successful_send_attempt_time: ~datetime.datetime - :ivar last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :vartype 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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthStatus - :keyword last_known_error: Last error obtained when a message failed to be delivered to iot - hub. - :paramtype last_known_error: str - :keyword last_known_error_time: Time at which the last known error occurred. - :paramtype last_known_error_time: ~datetime.datetime - :keyword last_successful_send_attempt_time: Last time iot hub successfully sent a message to - the endpoint. - :paramtype last_successful_send_attempt_time: ~datetime.datetime - :keyword last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :paramtype last_send_attempt_time: ~datetime.datetime - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: Required. The EventHub consumer group name. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupName - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, - } - - def __init__( - self, - *, - properties: "EventHubConsumerGroupName", - **kwargs - ): - """ - :keyword properties: Required. The EventHub consumer group name. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupName - """ - 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. - - :ivar properties: The tags. - :vartype properties: dict[str, any] - :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, Any]] = None, - **kwargs - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, any] - """ - 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. - - :ivar name: Required. EventHub consumer group name. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. EventHub consumer group name. - :paramtype name: str - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype exclude_keys: bool - :ivar 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. - :vartype export_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for export devices. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be exported. - :vartype include_configurations: bool - :ivar 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. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - :keyword 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. - :paramtype export_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for export devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - exported. - :paramtype include_configurations: bool - :keyword 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. - :paramtype configurations_blob_name: str - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 - :ivar properties: Required. The properties for a group information object. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword properties: Required. The properties for a group information object. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformationProperties - """ - 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. - - :ivar group_id: The group id. - :vartype group_id: str - :ivar required_members: The required members for a specific group id. - :vartype required_members: list[str] - :ivar required_zone_names: The required DNS zones for a specific group id. - :vartype 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 - ): - """ - :keyword group_id: The group id. - :paramtype group_id: str - :keyword required_members: The required members for a specific group id. - :paramtype required_members: list[str] - :keyword required_zone_names: The required DNS zones for a specific group id. - :paramtype required_zone_names: list[str] - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype output_blob_container_uri: str - :ivar input_blob_name: The blob name to be used when importing from the provided input blob - container. - :vartype input_blob_name: str - :ivar output_blob_name: The blob name to use for storing the status of the import job. - :vartype output_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for import devices. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be imported. - :vartype include_configurations: bool - :ivar configurations_blob_name: The blob name to be used when importing configurations from the - provided input blob container. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - :keyword input_blob_name: The blob name to be used when importing from the provided input blob - container. - :paramtype input_blob_name: str - :keyword output_blob_name: The blob name to use for storing the status of the import job. - :paramtype output_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for import devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - imported. - :paramtype include_configurations: bool - :keyword configurations_blob_name: The blob name to be used when importing configurations from - the provided input blob container. - :paramtype configurations_blob_name: str - """ - 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_07_01.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo - :ivar identity: The managed identities for the IotHub. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo - :keyword identity: The managed identities for the IotHub. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ArmIdentity - """ - 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype role: str or ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubReplicaRoleType - """ - 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_07_01.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] - :ivar disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used for - authentication. - :vartype disable_local_auth: bool - :ivar disable_device_sas: If true, all device(including Edge devices but excluding modules) - scoped SAS keys cannot be used for authentication. - :vartype disable_device_sas: bool - :ivar disable_module_sas: If true, all module scoped SAS keys cannot be used for - authentication. - :vartype disable_module_sas: bool - :ivar restrict_outbound_network_access: If true, egress from IotHub will be restricted to only - the allowed FQDNs that are configured via allowedFqdnList. - :vartype restrict_outbound_network_access: bool - :ivar allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Iot - Hub. - :vartype allowed_fqdn_list: list[str] - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.iothub.v2021_07_01.models.PublicNetworkAccess - :ivar ip_filter_rules: The IP filter rules. - :vartype ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_01.models.IpFilterRule] - :ivar network_rule_sets: Network Rule Set Properties of IotHub. - :vartype network_rule_sets: ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetProperties - :ivar 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. - :vartype min_tls_version: str - :ivar private_endpoint_connections: Private endpoint connections created on this IotHub. - :vartype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_07_01.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 - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2021_07_01.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2021_07_01.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2021_07_01.models.Capabilities - :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.v2021_07_01.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]'}, - 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, - 'disable_device_sas': {'key': 'disableDeviceSAS', 'type': 'bool'}, - 'disable_module_sas': {'key': 'disableModuleSAS', 'type': 'bool'}, - 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, - 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, - '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, - disable_local_auth: Optional[bool] = None, - disable_device_sas: Optional[bool] = None, - disable_module_sas: Optional[bool] = None, - restrict_outbound_network_access: Optional[bool] = None, - allowed_fqdn_list: Optional[List[str]] = 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 - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] - :keyword disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used - for authentication. - :paramtype disable_local_auth: bool - :keyword disable_device_sas: If true, all device(including Edge devices but excluding modules) - scoped SAS keys cannot be used for authentication. - :paramtype disable_device_sas: bool - :keyword disable_module_sas: If true, all module scoped SAS keys cannot be used for - authentication. - :paramtype disable_module_sas: bool - :keyword restrict_outbound_network_access: If true, egress from IotHub will be restricted to - only the allowed FQDNs that are configured via allowedFqdnList. - :paramtype restrict_outbound_network_access: bool - :keyword allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from - Iot Hub. - :paramtype allowed_fqdn_list: list[str] - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.iothub.v2021_07_01.models.PublicNetworkAccess - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_01.models.IpFilterRule] - :keyword network_rule_sets: Network Rule Set Properties of IotHub. - :paramtype network_rule_sets: ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetProperties - :keyword 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. - :paramtype min_tls_version: str - :keyword private_endpoint_connections: Private endpoint connections created on this IotHub. - :paramtype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2021_07_01.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_01.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2021_07_01.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2021_07_01.models.Capabilities - """ - super(IotHubProperties, self).__init__(**kwargs) - self.authorization_policies = authorization_policies - self.disable_local_auth = disable_local_auth - self.disable_device_sas = disable_device_sas - self.disable_module_sas = disable_module_sas - self.restrict_outbound_network_access = restrict_outbound_network_access - self.allowed_fqdn_list = allowed_fqdn_list - 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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2021_07_01.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype name: str or ~azure.mgmt.iothub.v2021_07_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.v2021_07_01.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2021_07_01.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2021_07_01.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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_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.v2021_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. - :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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class ManagedIdentity(msrest.serialization.Model): - """The properties of the Managed identity. - - :ivar user_assigned_identity: The user assigned identity. - :vartype user_assigned_identity: str - """ - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): - """ - :keyword user_assigned_identity: The user assigned identity. - :paramtype user_assigned_identity: str - """ - super(ManagedIdentity, self).__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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. - - :ivar filter_name: Required. Name of the IP filter rule. - :vartype filter_name: str - :ivar action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :vartype action: str or ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleIPAction - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. Name of the IP filter rule. - :paramtype filter_name: str - :keyword action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :paramtype action: str or ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleIPAction - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :vartype default_action: str or ~azure.mgmt.iothub.v2021_07_01.models.DefaultAction - :ivar apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :vartype apply_to_built_in_event_hub_endpoint: bool - :ivar ip_rules: Required. List of IP Rules. - :vartype ip_rules: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :paramtype default_action: str or ~azure.mgmt.iothub.v2021_07_01.models.DefaultAction - :keyword apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :paramtype apply_to_built_in_event_hub_endpoint: bool - :keyword ip_rules: Required. List of IP Rules. - :paramtype ip_rules: list[~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetIpRule] - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2021_07_01.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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_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 - """ - - _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 - :ivar properties: Required. The properties of a private endpoint connection. - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword properties: Required. The properties of a private endpoint connection. - :paramtype properties: - ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnectionProperties - """ - 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. - - :ivar private_endpoint: The private endpoint property of a private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpoint - :ivar private_link_service_connection_state: Required. The current state of a private endpoint - connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword private_endpoint: The private endpoint property of a private endpoint connection. - :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpoint - :keyword private_link_service_connection_state: Required. The current state of a private - endpoint connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionState - """ - 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. - - :ivar value: The list of available private link resources for an IotHub. - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, - } - - def __init__( - self, - *, - value: Optional[List["GroupIdInformation"]] = None, - **kwargs - ): - """ - :keyword value: The list of available private link resources for an IotHub. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation] - """ - 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. - - :ivar status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :vartype status: str or - ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionStatus - :ivar description: Required. The description for the current state of a private endpoint - connection. - :vartype description: str - :ivar actions_required: Actions required for a private endpoint connection. - :vartype 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 - ): - """ - :keyword status: Required. The status of a private endpoint connection. Possible values - include: "Pending", "Approved", "Rejected", "Disconnected". - :paramtype status: str or - ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionStatus - :keyword description: Required. The description for the current state of a private endpoint - connection. - :paramtype description: str - :keyword actions_required: Actions required for a private endpoint connection. - :paramtype actions_required: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2021_07_01.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2021_07_01.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar id: Id of the event hub endpoint. - :vartype id: str - :ivar connection_string: The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :vartype endpoint_uri: str - :ivar entity_path: Event hub name on the event hub namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the event hub endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of routing event hub endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the event hub endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Event hub name on the event hub namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the event hub endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of routing event hub endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2021_07_01.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2021_07_01.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2021_07_01.models.FallbackRouteProperties - :ivar 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. - :vartype enrichments: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2021_07_01.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2021_07_01.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2021_07_01.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: list[~azure.mgmt.iothub.v2021_07_01.models.EnrichmentProperties] - """ - 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. - - :ivar id: Id of the service bus queue endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus queue endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus queue endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus queue endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus queue - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus queue endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the service bus topic endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus topic. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus topic endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus topic endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus topic endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus topic. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus topic - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus topic endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the storage container endpoint. - :vartype id: str - :ivar connection_string: The connection string of the storage account. - :vartype connection_string: str - :ivar endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :vartype endpoint_uri: str - :ivar authentication_type: Method used to authenticate against the storage endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of routing storage endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype encoding: str or - ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword id: Id of the storage container endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the storage account. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :paramtype endpoint_uri: str - :keyword authentication_type: Method used to authenticate against the storage endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of routing storage endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2021_07_01.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype container_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for file upload. - :vartype identity: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for file upload. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity - """ - 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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2021_07_01.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2021_07_01.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2021_07_01.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2021_07_01.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2021_07_01.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2021_07_01.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2021_07_01.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2021_07_01.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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_07_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py deleted file mode 100644 index 17c6e3a304c3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_07_01.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_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py deleted file mode 100644 index bd2145e69f1e..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_01.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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py deleted file mode 100644 index f4cfb1ea2ee7..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2655 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription - or ~azure.mgmt.iothub.v2021_07_01.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_07_01.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_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_07_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_07_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_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.v2021_07_01.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py deleted file mode 100644 index f537383113e7..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_07_01.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_07_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 2cecc8862475..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,565 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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_07_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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_07_01/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py deleted file mode 100644 index b23e32727caf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py deleted file mode 100644 index 8d1262788fb2..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_01.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_07_01.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_01/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py deleted file mode 100644 index a9adde0a702d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py deleted file mode 100644 index 7aa790b27650..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-07-02" - 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py deleted file mode 100644 index 74613e0b7f83..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.v2021_07_02.operations.Operations - :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.v2021_07_02.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2021_07_02.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2021_07_02.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.v2021_07_02.operations.IotHubOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.iothub.v2021_07_02.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.iothub.v2021_07_02.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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_07_02/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json deleted file mode 100644 index fc907ed1419d..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "chosen_version": "2021-07-02", - "total_api_version_list": ["2021-07-02"], - "client": { - "name": "IotHubClient", - "filename": "_iot_hub_client", - "description": "Use this API to manage the IoT hubs in your Azure subscription.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": 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\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" - }, - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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_07_02/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py deleted file mode 100644 index f30401ec2040..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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 = "2.2.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py deleted file mode 100644 index 28356865df6a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py deleted file mode 100644 index e79e5e08062c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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, AsyncARMChallengeAuthenticationPolicy - -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: - super(IotHubClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-07-02" - 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py deleted file mode 100644 index 2ca594dc1cc8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import IotHubClientConfiguration -from .operations import CertificatesOperations, IotHubOperations, IotHubResourceOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceProviderCommonOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class IotHubClient: - """Use this API to manage the IoT hubs in your Azure subscription. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.v2021_07_02.aio.operations.Operations - :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: - azure.mgmt.iothub.v2021_07_02.aio.operations.IotHubResourceOperations - :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: - azure.mgmt.iothub.v2021_07_02.aio.operations.ResourceProviderCommonOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.v2021_07_02.aio.operations.CertificatesOperations - :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.v2021_07_02.aio.operations.IotHubOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.iothub.v2021_07_02.aio.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.iothub.v2021_07_02.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 base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - :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: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = IotHubClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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_07_02/aio/_patch.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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_07_02/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py deleted file mode 100644 index 8e75c6f4bb47..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,425 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_generate_verification_code_request, build_get_request, build_list_by_iot_hub_request, build_verify_request -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_07_02.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 - - @distributed_trace_async - async def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py deleted file mode 100644 index 6a7c82f3c1b0..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_operations import build_manual_failover_request_initial -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_07_02.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: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_07_02/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py deleted file mode 100644 index fb95b8569b74..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,1768 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._iot_hub_resource_operations import build_check_name_availability_request, build_create_event_hub_consumer_group_request, build_create_or_update_request_initial, build_delete_event_hub_consumer_group_request, build_delete_request_initial, build_export_devices_request, build_get_endpoint_health_request, build_get_event_hub_consumer_group_request, build_get_job_request, build_get_keys_for_key_name_request, build_get_quota_metrics_request, build_get_request, build_get_stats_request, build_get_valid_skus_request, build_import_devices_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_hub_consumer_groups_request, build_list_jobs_request, build_list_keys_request, build_test_all_routes_request, build_test_route_request, build_update_request_initial -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_07_02.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 - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - 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: Any - ) -> 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_07_02.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_02.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_02.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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 ErrorDetails or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription or - ~azure.mgmt.iothub.v2021_07_02.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - 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: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace_async - async def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py deleted file mode 100644 index e81caf24e1bd..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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_07_02.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_07_02/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 383a92b2a9e3..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# 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 functools -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 -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -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_07_02.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_02.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.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_07_02.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_07_02/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index 5373e65bc860..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_request -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_07_02.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 - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py deleted file mode 100644 index 3ffa8304be0c..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,91 +0,0 @@ -# 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 functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_provider_common_operations import build_get_subscription_quota_request -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_07_02.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 - - @distributed_trace_async - async def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py deleted file mode 100644 index 6210793d54ee..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py +++ /dev/null @@ -1,223 +0,0 @@ -# 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 ._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 SystemData -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 - - -from ._iot_hub_client_enums import ( - AccessRights, - AuthenticationType, - Capabilities, - CreatedByType, - 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', - 'SystemData', - 'TagsResource', - 'TestAllRoutesInput', - 'TestAllRoutesResult', - 'TestRouteInput', - 'TestRouteResult', - 'TestRouteResultDetails', - 'UserSubscriptionQuota', - 'UserSubscriptionQuotaListResult', - 'AccessRights', - 'AuthenticationType', - 'Capabilities', - 'CreatedByType', - '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_07_02/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_iot_hub_client_enums.py deleted file mode 100644 index f01b6b296087..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_iot_hub_client_enums.py +++ /dev/null @@ -1,225 +0,0 @@ -# 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 -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -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 CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that created the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -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_07_02/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py deleted file mode 100644 index 3255ed194db9..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py +++ /dev/null @@ -1,4150 +0,0 @@ -# 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 Any, 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 - :ivar 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". - :vartype type: str or ~azure.mgmt.iothub.v2021_07_02.models.ResourceIdentityType - :ivar user_assigned_identities: Dictionary of :code:``. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.iothub.v2021_07_02.models.ResourceIdentityType - :keyword user_assigned_identities: Dictionary of :code:``. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.ArmUserIdentity] - """ - 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. - - :ivar certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem - file content. - :vartype certificate: str - :ivar is_verified: True indicates that the certificate will be created in verified state and - proof of possession will not be required. - :vartype is_verified: bool - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - is_verified: Optional[bool] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just - .pem file content. - :paramtype certificate: str - :keyword is_verified: True indicates that the certificate will be created in verified state and - proof of possession will not be required. - :paramtype is_verified: bool - """ - super(CertificateBodyDescription, self).__init__(**kwargs) - self.certificate = certificate - self.is_verified = is_verified - - -class CertificateDescription(msrest.serialization.Model): - """The X509 Certificate. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar properties: The description of an X509 CA Certificate. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.CertificateProperties - """ - 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. - - :ivar value: The array of Certificate objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateDescription]'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateDescription"]] = None, - **kwargs - ): - """ - :keyword value: The array of Certificate objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription] - """ - 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 - :ivar certificate: The certificate content. - :vartype certificate: str - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'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, - *, - is_verified: Optional[bool] = None, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword is_verified: Determines whether certificate has been verified. - :paramtype is_verified: bool - :keyword certificate: The certificate content. - :paramtype certificate: str - """ - super(CertificateProperties, self).__init__(**kwargs) - self.subject = None - self.expiry = None - self.thumbprint = None - self.is_verified = is_verified - 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. - - :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :vartype certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__( - self, - *, - certificate: Optional[str] = None, - **kwargs - ): - """ - :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file - content. - :paramtype certificate: str - """ - 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. - - :ivar properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword properties: The description of an X509 CA Certificate including the challenge nonce - issued for the Proof-Of-Possession flow. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.CertificatePropertiesWithNonce - """ - 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. - - :ivar 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. - :vartype max_delivery_count: int - :ivar 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. - :vartype default_ttl_as_iso8601: ~datetime.timedelta - :ivar feedback: The properties of the feedback queue for cloud-to-device messages. - :vartype feedback: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword 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. - :paramtype max_delivery_count: int - :keyword 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. - :paramtype default_ttl_as_iso8601: ~datetime.timedelta - :keyword feedback: The properties of the feedback queue for cloud-to-device messages. - :paramtype feedback: ~azure.mgmt.iothub.v2021_07_02.models.FeedbackProperties - """ - 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. - - :ivar endpoint_id: Id of the endpoint. - :vartype endpoint_id: str - :ivar 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". - :vartype health_status: str or ~azure.mgmt.iothub.v2021_07_02.models.EndpointHealthStatus - :ivar last_known_error: Last error obtained when a message failed to be delivered to iot hub. - :vartype last_known_error: str - :ivar last_known_error_time: Time at which the last known error occurred. - :vartype last_known_error_time: ~datetime.datetime - :ivar last_successful_send_attempt_time: Last time iot hub successfully sent a message to the - endpoint. - :vartype last_successful_send_attempt_time: ~datetime.datetime - :ivar last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :vartype 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 - ): - """ - :keyword endpoint_id: Id of the endpoint. - :paramtype endpoint_id: str - :keyword 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". - :paramtype health_status: str or ~azure.mgmt.iothub.v2021_07_02.models.EndpointHealthStatus - :keyword last_known_error: Last error obtained when a message failed to be delivered to iot - hub. - :paramtype last_known_error: str - :keyword last_known_error_time: Time at which the last known error occurred. - :paramtype last_known_error_time: ~datetime.datetime - :keyword last_successful_send_attempt_time: Last time iot hub successfully sent a message to - the endpoint. - :paramtype last_successful_send_attempt_time: ~datetime.datetime - :keyword last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. - :paramtype last_send_attempt_time: ~datetime.datetime - """ - 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. - - :ivar value: JSON-serialized array of Endpoint health data. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: JSON-serialized array of Endpoint health data. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.EndpointHealthData] - """ - 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. - - :ivar key: Required. The key or name for the enrichment property. - :vartype key: str - :ivar value: Required. The value for the enrichment property. - :vartype value: str - :ivar endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :vartype 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 - ): - """ - :keyword key: Required. The key or name for the enrichment property. - :paramtype key: str - :keyword value: Required. The value for the enrichment property. - :paramtype value: str - :keyword endpoint_names: Required. The list of endpoints for which the enrichment is applied to - the message. - :paramtype endpoint_names: list[str] - """ - 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. - - :ivar properties: Required. The EventHub consumer group name. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupName - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, - } - - def __init__( - self, - *, - properties: "EventHubConsumerGroupName", - **kwargs - ): - """ - :keyword properties: Required. The EventHub consumer group name. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupName - """ - 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. - - :ivar properties: The tags. - :vartype properties: dict[str, any] - :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, Any]] = None, - **kwargs - ): - """ - :keyword properties: The tags. - :paramtype properties: dict[str, any] - """ - 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. - - :ivar name: Required. EventHub consumer group name. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. EventHub consumer group name. - :paramtype name: str - """ - 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. - - :ivar value: List of consumer groups objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: List of consumer groups objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo] - """ - 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. - - :ivar 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. - :vartype retention_time_in_days: long - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype retention_time_in_days: long - :keyword 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. - :paramtype partition_count: int - """ - 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. - - :ivar export_blob_container_uri: Required. The export blob container URI. - :vartype export_blob_container_uri: str - :ivar exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :vartype exclude_keys: bool - :ivar 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. - :vartype export_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for export devices. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be exported. - :vartype include_configurations: bool - :ivar 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. - :vartype 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 - ): - """ - :keyword export_blob_container_uri: Required. The export blob container URI. - :paramtype export_blob_container_uri: str - :keyword exclude_keys: Required. The value indicating whether keys should be excluded during - export. - :paramtype exclude_keys: bool - :keyword 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. - :paramtype export_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for export devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - exported. - :paramtype include_configurations: bool - :keyword 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. - :paramtype configurations_blob_name: str - """ - 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. - - :ivar failover_region: Required. Region the hub will be failed over to. - :vartype failover_region: str - """ - - _validation = { - 'failover_region': {'required': True}, - } - - _attribute_map = { - 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - failover_region: str, - **kwargs - ): - """ - :keyword failover_region: Required. Region the hub will be failed over to. - :paramtype failover_region: str - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether the fallback route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which the messages that satisfy the - condition are routed to. Currently only 1 endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether the fallback route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar 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. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword 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. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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 - :ivar properties: Required. The properties for a group information object. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword properties: Required. The properties for a group information object. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformationProperties - """ - 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. - - :ivar group_id: The group id. - :vartype group_id: str - :ivar required_members: The required members for a specific group id. - :vartype required_members: list[str] - :ivar required_zone_names: The required DNS zones for a specific group id. - :vartype 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 - ): - """ - :keyword group_id: The group id. - :paramtype group_id: str - :keyword required_members: The required members for a specific group id. - :paramtype required_members: list[str] - :keyword required_zone_names: The required DNS zones for a specific group id. - :paramtype required_zone_names: list[str] - """ - 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. - - :ivar input_blob_container_uri: Required. The input blob container URI. - :vartype input_blob_container_uri: str - :ivar output_blob_container_uri: Required. The output blob container URI. - :vartype output_blob_container_uri: str - :ivar input_blob_name: The blob name to be used when importing from the provided input blob - container. - :vartype input_blob_name: str - :ivar output_blob_name: The blob name to use for storing the status of the import job. - :vartype output_blob_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for import devices. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar include_configurations: The value indicating whether configurations should be imported. - :vartype include_configurations: bool - :ivar configurations_blob_name: The blob name to be used when importing configurations from the - provided input blob container. - :vartype 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 - ): - """ - :keyword input_blob_container_uri: Required. The input blob container URI. - :paramtype input_blob_container_uri: str - :keyword output_blob_container_uri: Required. The output blob container URI. - :paramtype output_blob_container_uri: str - :keyword input_blob_name: The blob name to be used when importing from the provided input blob - container. - :paramtype input_blob_name: str - :keyword output_blob_name: The blob name to use for storing the status of the import job. - :paramtype output_blob_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for import devices. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword include_configurations: The value indicating whether configurations should be - imported. - :paramtype include_configurations: bool - :keyword configurations_blob_name: The blob name to be used when importing configurations from - the provided input blob container. - :paramtype configurations_blob_name: str - """ - 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_07_02.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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - """ - 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 - :ivar location: Required. The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar 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. - :vartype etag: str - :ivar properties: IotHub properties. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.models.IotHubProperties - :ivar sku: Required. IotHub SKU info. - :vartype sku: ~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuInfo - :ivar identity: The managed identities for the IotHub. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ArmIdentity - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.iothub.v2021_07_02.models.SystemData - """ - - _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}, - 'system_data': {'readonly': 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'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - 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 - ): - """ - :keyword location: Required. The resource location. - :paramtype location: str - :keyword tags: A set of tags. The resource tags. - :paramtype tags: dict[str, str] - :keyword 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. - :paramtype etag: str - :keyword properties: IotHub properties. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.IotHubProperties - :keyword sku: Required. IotHub SKU info. - :paramtype sku: ~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuInfo - :keyword identity: The managed identities for the IotHub. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ArmIdentity - """ - super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) - self.etag = etag - self.properties = properties - self.sku = sku - self.identity = identity - self.system_data = 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. - - :ivar value: The array of IotHubDescription objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: The array of IotHubDescription objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription] - """ - 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. - - :ivar location: The name of the Azure region. - :vartype location: str - :ivar 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". - :vartype role: str or ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword location: The name of the Azure region. - :paramtype location: str - :keyword 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". - :paramtype role: str or ~azure.mgmt.iothub.v2021_07_02.models.IotHubReplicaRoleType - """ - 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_07_02.models.IotHubNameUnavailabilityReason - :ivar message: The detailed reason message. - :vartype 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 - ): - """ - :keyword message: The detailed reason message. - :paramtype message: str - """ - 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. - - :ivar authorization_policies: The shared access policies you can use to secure a connection to - the IoT hub. - :vartype authorization_policies: - list[~azure.mgmt.iothub.v2021_07_02.models.SharedAccessSignatureAuthorizationRule] - :ivar disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used for - authentication. - :vartype disable_local_auth: bool - :ivar disable_device_sas: If true, all device(including Edge devices but excluding modules) - scoped SAS keys cannot be used for authentication. - :vartype disable_device_sas: bool - :ivar disable_module_sas: If true, all module scoped SAS keys cannot be used for - authentication. - :vartype disable_module_sas: bool - :ivar restrict_outbound_network_access: If true, egress from IotHub will be restricted to only - the allowed FQDNs that are configured via allowedFqdnList. - :vartype restrict_outbound_network_access: bool - :ivar allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Iot - Hub. - :vartype allowed_fqdn_list: list[str] - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.iothub.v2021_07_02.models.PublicNetworkAccess - :ivar ip_filter_rules: The IP filter rules. - :vartype ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_02.models.IpFilterRule] - :ivar network_rule_sets: Network Rule Set Properties of IotHub. - :vartype network_rule_sets: ~azure.mgmt.iothub.v2021_07_02.models.NetworkRuleSetProperties - :ivar 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. - :vartype min_tls_version: str - :ivar private_endpoint_connections: Private endpoint connections created on this IotHub. - :vartype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_07_02.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 - :ivar 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. - :vartype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.EventHubProperties] - :ivar routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :vartype routing: ~azure.mgmt.iothub.v2021_07_02.models.RoutingProperties - :ivar 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. - :vartype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.StorageEndpointProperties] - :ivar messaging_endpoints: The messaging endpoint properties for the file upload notification - queue. - :vartype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.MessagingEndpointProperties] - :ivar enable_file_upload_notifications: If True, file upload notifications are enabled. - :vartype enable_file_upload_notifications: bool - :ivar cloud_to_device: The IoT hub cloud-to-device messaging properties. - :vartype cloud_to_device: ~azure.mgmt.iothub.v2021_07_02.models.CloudToDeviceProperties - :ivar comments: IoT hub comments. - :vartype comments: str - :ivar features: The capabilities and features enabled for the IoT hub. Possible values include: - "None", "DeviceManagement". - :vartype features: str or ~azure.mgmt.iothub.v2021_07_02.models.Capabilities - :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubLocationDescription] - :ivar enable_data_residency: This property when set to true, will enable data residency, thus, - disabling disaster recovery. - :vartype enable_data_residency: bool - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'host_name': {'readonly': True}, - 'locations': {'readonly': True}, - } - - _attribute_map = { - 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, - 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, - 'disable_device_sas': {'key': 'disableDeviceSAS', 'type': 'bool'}, - 'disable_module_sas': {'key': 'disableModuleSAS', 'type': 'bool'}, - 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, - 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, - '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]'}, - 'enable_data_residency': {'key': 'enableDataResidency', 'type': 'bool'}, - } - - def __init__( - self, - *, - authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, - disable_local_auth: Optional[bool] = None, - disable_device_sas: Optional[bool] = None, - disable_module_sas: Optional[bool] = None, - restrict_outbound_network_access: Optional[bool] = None, - allowed_fqdn_list: Optional[List[str]] = 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, - enable_data_residency: Optional[bool] = None, - **kwargs - ): - """ - :keyword authorization_policies: The shared access policies you can use to secure a connection - to the IoT hub. - :paramtype authorization_policies: - list[~azure.mgmt.iothub.v2021_07_02.models.SharedAccessSignatureAuthorizationRule] - :keyword disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used - for authentication. - :paramtype disable_local_auth: bool - :keyword disable_device_sas: If true, all device(including Edge devices but excluding modules) - scoped SAS keys cannot be used for authentication. - :paramtype disable_device_sas: bool - :keyword disable_module_sas: If true, all module scoped SAS keys cannot be used for - authentication. - :paramtype disable_module_sas: bool - :keyword restrict_outbound_network_access: If true, egress from IotHub will be restricted to - only the allowed FQDNs that are configured via allowedFqdnList. - :paramtype restrict_outbound_network_access: bool - :keyword allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from - Iot Hub. - :paramtype allowed_fqdn_list: list[str] - :keyword public_network_access: Whether requests from Public Network are allowed. Possible - values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.iothub.v2021_07_02.models.PublicNetworkAccess - :keyword ip_filter_rules: The IP filter rules. - :paramtype ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_02.models.IpFilterRule] - :keyword network_rule_sets: Network Rule Set Properties of IotHub. - :paramtype network_rule_sets: ~azure.mgmt.iothub.v2021_07_02.models.NetworkRuleSetProperties - :keyword 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. - :paramtype min_tls_version: str - :keyword private_endpoint_connections: Private endpoint connections created on this IotHub. - :paramtype private_endpoint_connections: - list[~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection] - :keyword 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. - :paramtype event_hub_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.EventHubProperties] - :keyword routing: The routing related properties of the IoT hub. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :paramtype routing: ~azure.mgmt.iothub.v2021_07_02.models.RoutingProperties - :keyword 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. - :paramtype storage_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.StorageEndpointProperties] - :keyword messaging_endpoints: The messaging endpoint properties for the file upload - notification queue. - :paramtype messaging_endpoints: dict[str, - ~azure.mgmt.iothub.v2021_07_02.models.MessagingEndpointProperties] - :keyword enable_file_upload_notifications: If True, file upload notifications are enabled. - :paramtype enable_file_upload_notifications: bool - :keyword cloud_to_device: The IoT hub cloud-to-device messaging properties. - :paramtype cloud_to_device: ~azure.mgmt.iothub.v2021_07_02.models.CloudToDeviceProperties - :keyword comments: IoT hub comments. - :paramtype comments: str - :keyword features: The capabilities and features enabled for the IoT hub. Possible values - include: "None", "DeviceManagement". - :paramtype features: str or ~azure.mgmt.iothub.v2021_07_02.models.Capabilities - :keyword enable_data_residency: This property when set to true, will enable data residency, - thus, disabling disaster recovery. - :paramtype enable_data_residency: bool - """ - super(IotHubProperties, self).__init__(**kwargs) - self.authorization_policies = authorization_policies - self.disable_local_auth = disable_local_auth - self.disable_device_sas = disable_device_sas - self.disable_module_sas = disable_module_sas - self.restrict_outbound_network_access = restrict_outbound_network_access - self.allowed_fqdn_list = allowed_fqdn_list - 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 - self.enable_data_residency = enable_data_residency - - -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. - - :ivar value: The array of quota metrics objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: The array of quota metrics objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubQuotaMetricInfo] - """ - 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 - :ivar sku: Required. The type of the resource. - :vartype sku: ~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuInfo - :ivar capacity: Required. IotHub capacity. - :vartype capacity: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword sku: Required. The type of the resource. - :paramtype sku: ~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuInfo - :keyword capacity: Required. IotHub capacity. - :paramtype capacity: ~azure.mgmt.iothub.v2021_07_02.models.IotHubCapacity - """ - 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. - - :ivar value: The array of IotHubSkuDescription. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: The array of IotHubSkuDescription. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuDescription] - """ - 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. - - :ivar name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :vartype name: str or ~azure.mgmt.iothub.v2021_07_02.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_07_02.models.IotHubSkuTier - :ivar capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :vartype 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 - ): - """ - :keyword name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", - "B1", "B2", "B3". - :paramtype name: str or ~azure.mgmt.iothub.v2021_07_02.models.IotHubSku - :keyword capacity: The number of provisioned IoT Hub units. See: - https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. - :paramtype capacity: long - """ - 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. - - :ivar filter_name: Required. The name of the IP filter rule. - :vartype filter_name: str - :ivar action: Required. The desired action for requests captured by this rule. Possible values - include: "Accept", "Reject". - :vartype action: str or ~azure.mgmt.iothub.v2021_07_02.models.IpFilterActionType - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. The name of the IP filter rule. - :paramtype filter_name: str - :keyword action: Required. The desired action for requests captured by this rule. Possible - values include: "Accept", "Reject". - :paramtype action: str or ~azure.mgmt.iothub.v2021_07_02.models.IpFilterActionType - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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_07_02.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_07_02.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. - - :ivar value: The array of JobResponse objects. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: The array of JobResponse objects. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.JobResponse] - """ - super(JobResponseListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class ManagedIdentity(msrest.serialization.Model): - """The properties of the Managed identity. - - :ivar user_assigned_identity: The user assigned identity. - :vartype user_assigned_identity: str - """ - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): - """ - :keyword user_assigned_identity: The user assigned identity. - :paramtype user_assigned_identity: str - """ - super(ManagedIdentity, self).__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity - - -class MatchedRoute(msrest.serialization.Model): - """Routes that matched. - - :ivar properties: Properties of routes that matched. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.models.RouteProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RouteProperties'}, - } - - def __init__( - self, - *, - properties: Optional["RouteProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of routes that matched. - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.RouteProperties - """ - super(MatchedRoute, self).__init__(**kwargs) - self.properties = properties - - -class MessagingEndpointProperties(msrest.serialization.Model): - """The properties of the messaging endpoints used by this IoT hub. - - :ivar lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :vartype lock_duration_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype ttl_as_iso8601: ~datetime.timedelta - :ivar 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. - :vartype 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 - ): - """ - :keyword lock_duration_as_iso8601: The lock duration. See: - https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. - :paramtype lock_duration_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype ttl_as_iso8601: ~datetime.timedelta - :keyword 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. - :paramtype max_delivery_count: int - """ - 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. - - :ivar value: IotHub type. - :vartype value: str - :ivar localized_value: Localized value of name. - :vartype 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 - ): - """ - :keyword value: IotHub type. - :paramtype value: str - :keyword localized_value: Localized value of name. - :paramtype localized_value: str - """ - 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. - - :ivar filter_name: Required. Name of the IP filter rule. - :vartype filter_name: str - :ivar action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :vartype action: str or ~azure.mgmt.iothub.v2021_07_02.models.NetworkRuleIPAction - :ivar ip_mask: Required. A string that contains the IP address range in CIDR notation for the - rule. - :vartype 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 - ): - """ - :keyword filter_name: Required. Name of the IP filter rule. - :paramtype filter_name: str - :keyword action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". - :paramtype action: str or ~azure.mgmt.iothub.v2021_07_02.models.NetworkRuleIPAction - :keyword ip_mask: Required. A string that contains the IP address range in CIDR notation for - the rule. - :paramtype ip_mask: str - """ - 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. - - :ivar default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :vartype default_action: str or ~azure.mgmt.iothub.v2021_07_02.models.DefaultAction - :ivar apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :vartype apply_to_built_in_event_hub_endpoint: bool - :ivar ip_rules: Required. List of IP Rules. - :vartype ip_rules: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword default_action: Default Action for Network Rule Set. Possible values include: "Deny", - "Allow". Default value: "Deny". - :paramtype default_action: str or ~azure.mgmt.iothub.v2021_07_02.models.DefaultAction - :keyword apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also - applied to BuiltIn EventHub EndPoint of IotHub. - :paramtype apply_to_built_in_event_hub_endpoint: bool - :keyword ip_rules: Required. List of IP Rules. - :paramtype ip_rules: list[~azure.mgmt.iothub.v2021_07_02.models.NetworkRuleSetIpRule] - """ - 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 - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.iothub.v2021_07_02.models.OperationDisplay - """ - 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. - - :ivar name: Required. The name of the IoT hub to check. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. The name of the IoT hub to check. - :paramtype name: str - """ - 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_07_02.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 - :ivar properties: Required. The properties of a private endpoint connection. - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword properties: Required. The properties of a private endpoint connection. - :paramtype properties: - ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnectionProperties - """ - 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. - - :ivar private_endpoint: The private endpoint property of a private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpoint - :ivar private_link_service_connection_state: Required. The current state of a private endpoint - connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword private_endpoint: The private endpoint property of a private endpoint connection. - :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpoint - :keyword private_link_service_connection_state: Required. The current state of a private - endpoint connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.iothub.v2021_07_02.models.PrivateLinkServiceConnectionState - """ - 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. - - :ivar value: The list of available private link resources for an IotHub. - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, - } - - def __init__( - self, - *, - value: Optional[List["GroupIdInformation"]] = None, - **kwargs - ): - """ - :keyword value: The list of available private link resources for an IotHub. - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformation] - """ - 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. - - :ivar status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :vartype status: str or - ~azure.mgmt.iothub.v2021_07_02.models.PrivateLinkServiceConnectionStatus - :ivar description: Required. The description for the current state of a private endpoint - connection. - :vartype description: str - :ivar actions_required: Actions required for a private endpoint connection. - :vartype 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 - ): - """ - :keyword status: Required. The status of a private endpoint connection. Possible values - include: "Pending", "Approved", "Rejected", "Disconnected". - :paramtype status: str or - ~azure.mgmt.iothub.v2021_07_02.models.PrivateLinkServiceConnectionStatus - :keyword description: Required. The description for the current state of a private endpoint - connection. - :paramtype description: str - :keyword actions_required: Actions required for a private endpoint connection. - :paramtype actions_required: str - """ - 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. - - :ivar message: Route error message. - :vartype message: str - :ivar severity: Severity of the route error. Possible values include: "error", "warning". - :vartype severity: str or ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorSeverity - :ivar location: Location where the route error happened. - :vartype location: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword message: Route error message. - :paramtype message: str - :keyword severity: Severity of the route error. Possible values include: "error", "warning". - :paramtype severity: str or ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorSeverity - :keyword location: Location where the route error happened. - :paramtype location: ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorRange - """ - 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. - - :ivar line: Line where the route error happened. - :vartype line: int - :ivar column: Column where the route error happened. - :vartype 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 - ): - """ - :keyword line: Line where the route error happened. - :paramtype line: int - :keyword column: Column where the route error happened. - :paramtype column: int - """ - super(RouteErrorPosition, self).__init__(**kwargs) - self.line = line - self.column = column - - -class RouteErrorRange(msrest.serialization.Model): - """Range of route errors. - - :ivar start: Start where the route error happened. - :vartype start: ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorPosition - :ivar end: End where the route error happened. - :vartype end: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword start: Start where the route error happened. - :paramtype start: ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorPosition - :keyword end: End where the route error happened. - :paramtype end: ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorPosition - """ - 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. - - :ivar 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. - :vartype name: str - :ivar 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". - :vartype source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :ivar 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. - :vartype condition: str - :ivar endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :vartype endpoint_names: list[str] - :ivar is_enabled: Required. Used to specify whether a route is enabled. - :vartype 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 - ): - """ - :keyword 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. - :paramtype name: str - :keyword 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". - :paramtype source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :keyword 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. - :paramtype condition: str - :keyword endpoint_names: Required. The list of endpoints to which messages that satisfy the - condition are routed. Currently only one endpoint is allowed. - :paramtype endpoint_names: list[str] - :keyword is_enabled: Required. Used to specify whether a route is enabled. - :paramtype is_enabled: bool - """ - 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. - - :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_queues: - list[~azure.mgmt.iothub.v2021_07_02.models.RoutingServiceBusQueueEndpointProperties] - :ivar service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the - messages to, based on the routing rules. - :vartype service_bus_topics: - list[~azure.mgmt.iothub.v2021_07_02.models.RoutingServiceBusTopicEndpointProperties] - :ivar 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. - :vartype event_hubs: list[~azure.mgmt.iothub.v2021_07_02.models.RoutingEventHubProperties] - :ivar storage_containers: The list of storage container endpoints that IoT hub routes messages - to, based on the routing rules. - :vartype storage_containers: - list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the - messages to, based on the routing rules. - :paramtype service_bus_queues: - list[~azure.mgmt.iothub.v2021_07_02.models.RoutingServiceBusQueueEndpointProperties] - :keyword service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes - the messages to, based on the routing rules. - :paramtype service_bus_topics: - list[~azure.mgmt.iothub.v2021_07_02.models.RoutingServiceBusTopicEndpointProperties] - :keyword 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. - :paramtype event_hubs: list[~azure.mgmt.iothub.v2021_07_02.models.RoutingEventHubProperties] - :keyword storage_containers: The list of storage container endpoints that IoT hub routes - messages to, based on the routing rules. - :paramtype storage_containers: - list[~azure.mgmt.iothub.v2021_07_02.models.RoutingStorageContainerProperties] - """ - 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. - - :ivar id: Id of the event hub endpoint. - :vartype id: str - :ivar connection_string: The connection string of the event hub endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :vartype endpoint_uri: str - :ivar entity_path: Event hub name on the event hub namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the event hub endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of routing event hub endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the event hub endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the event hub endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the event hub endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the event hub endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Event hub name on the event hub namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the event hub endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of routing event hub endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the event hub endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the event hub endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar body: Body of routing message. - :vartype body: str - :ivar app_properties: App properties. - :vartype app_properties: dict[str, str] - :ivar system_properties: System properties. - :vartype 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 - ): - """ - :keyword body: Body of routing message. - :paramtype body: str - :keyword app_properties: App properties. - :paramtype app_properties: dict[str, str] - :keyword system_properties: System properties. - :paramtype system_properties: dict[str, str] - """ - 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. - - :ivar 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. - :vartype endpoints: ~azure.mgmt.iothub.v2021_07_02.models.RoutingEndpoints - :ivar 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. - :vartype routes: list[~azure.mgmt.iothub.v2021_07_02.models.RouteProperties] - :ivar 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. - :vartype fallback_route: ~azure.mgmt.iothub.v2021_07_02.models.FallbackRouteProperties - :ivar 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. - :vartype enrichments: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword 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. - :paramtype endpoints: ~azure.mgmt.iothub.v2021_07_02.models.RoutingEndpoints - :keyword 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. - :paramtype routes: list[~azure.mgmt.iothub.v2021_07_02.models.RouteProperties] - :keyword 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. - :paramtype fallback_route: ~azure.mgmt.iothub.v2021_07_02.models.FallbackRouteProperties - :keyword 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. - :paramtype enrichments: list[~azure.mgmt.iothub.v2021_07_02.models.EnrichmentProperties] - """ - 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. - - :ivar id: Id of the service bus queue endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus queue endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus namespace. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus queue endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus queue endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus queue endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus queue endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus queue endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus queue endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus queue endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus namespace. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus queue - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus queue endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus queue endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus queue endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the service bus topic endpoint. - :vartype id: str - :ivar connection_string: The connection string of the service bus topic endpoint. - :vartype connection_string: str - :ivar endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :vartype endpoint_uri: str - :ivar entity_path: Queue name on the service bus topic. - :vartype entity_path: str - :ivar authentication_type: Method used to authenticate against the service bus topic endpoint. - Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of routing service bus topic endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the service bus topic endpoint. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the service bus topic endpoint. - :vartype 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 - ): - """ - :keyword id: Id of the service bus topic endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the service bus topic endpoint. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the service bus topic endpoint. It must include the protocol - sb://. - :paramtype endpoint_uri: str - :keyword entity_path: Queue name on the service bus topic. - :paramtype entity_path: str - :keyword authentication_type: Method used to authenticate against the service bus topic - endpoint. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of routing service bus topic endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the service bus topic endpoint. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the service bus topic endpoint. - :paramtype resource_group: str - """ - 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. - - :ivar id: Id of the storage container endpoint. - :vartype id: str - :ivar connection_string: The connection string of the storage account. - :vartype connection_string: str - :ivar endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :vartype endpoint_uri: str - :ivar authentication_type: Method used to authenticate against the storage endpoint. Possible - values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of routing storage endpoint. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :ivar 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. - :vartype name: str - :ivar subscription_id: The subscription identifier of the storage account. - :vartype subscription_id: str - :ivar resource_group: The name of the resource group of the storage account. - :vartype resource_group: str - :ivar container_name: Required. The name of storage container in the storage account. - :vartype container_name: str - :ivar 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. - :vartype file_name_format: str - :ivar 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. - :vartype batch_frequency_in_seconds: int - :ivar 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). - :vartype max_chunk_size_in_bytes: int - :ivar 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". - :vartype encoding: str or - ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword id: Id of the storage container endpoint. - :paramtype id: str - :keyword connection_string: The connection string of the storage account. - :paramtype connection_string: str - :keyword endpoint_uri: The url of the storage endpoint. It must include the protocol https://. - :paramtype endpoint_uri: str - :keyword authentication_type: Method used to authenticate against the storage endpoint. - Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of routing storage endpoint. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - :keyword 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. - :paramtype name: str - :keyword subscription_id: The subscription identifier of the storage account. - :paramtype subscription_id: str - :keyword resource_group: The name of the resource group of the storage account. - :paramtype resource_group: str - :keyword container_name: Required. The name of storage container in the storage account. - :paramtype container_name: str - :keyword 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. - :paramtype file_name_format: str - :keyword 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. - :paramtype batch_frequency_in_seconds: int - :keyword 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). - :paramtype max_chunk_size_in_bytes: int - :keyword 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". - :paramtype encoding: str or - ~azure.mgmt.iothub.v2021_07_02.models.RoutingStorageContainerPropertiesEncoding - """ - 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. - - :ivar tags: A set of tags. Twin Tags. - :vartype tags: any - :ivar properties: - :vartype properties: ~azure.mgmt.iothub.v2021_07_02.models.RoutingTwinProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, - 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Any] = None, - properties: Optional["RoutingTwinProperties"] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Twin Tags. - :paramtype tags: any - :keyword properties: - :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.RoutingTwinProperties - """ - super(RoutingTwin, self).__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class RoutingTwinProperties(msrest.serialization.Model): - """RoutingTwinProperties. - - :ivar desired: Twin desired properties. - :vartype desired: any - :ivar reported: Twin desired properties. - :vartype reported: any - """ - - _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, - } - - def __init__( - self, - *, - desired: Optional[Any] = None, - reported: Optional[Any] = None, - **kwargs - ): - """ - :keyword desired: Twin desired properties. - :paramtype desired: any - :keyword reported: Twin desired properties. - :paramtype reported: any - """ - 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. - - :ivar key_name: Required. The name of the shared access policy. - :vartype key_name: str - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str - :ivar 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". - :vartype rights: str or ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword key_name: Required. The name of the shared access policy. - :paramtype key_name: str - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str - :keyword 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". - :paramtype rights: str or ~azure.mgmt.iothub.v2021_07_02.models.AccessRights - """ - 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. - - :ivar value: The list of shared access policies. - :vartype value: - list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: The list of shared access policies. - :paramtype value: - list[~azure.mgmt.iothub.v2021_07_02.models.SharedAccessSignatureAuthorizationRule] - """ - 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. - - :ivar 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. - :vartype sas_ttl_as_iso8601: ~datetime.timedelta - :ivar connection_string: Required. The connection string for the Azure Storage account to which - files are uploaded. - :vartype connection_string: str - :ivar 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. - :vartype container_name: str - :ivar authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :vartype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :ivar identity: Managed identity properties of storage endpoint for file upload. - :vartype identity: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword 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. - :paramtype sas_ttl_as_iso8601: ~datetime.timedelta - :keyword connection_string: Required. The connection string for the Azure Storage account to - which files are uploaded. - :paramtype connection_string: str - :keyword 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. - :paramtype container_name: str - :keyword authentication_type: Specifies authentication type being used for connecting to the - storage account. Possible values include: "keyBased", "identityBased". - :paramtype authentication_type: str or ~azure.mgmt.iothub.v2021_07_02.models.AuthenticationType - :keyword identity: Managed identity properties of storage endpoint for file upload. - :paramtype identity: ~azure.mgmt.iothub.v2021_07_02.models.ManagedIdentity - """ - 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 SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure.mgmt.iothub.v2021_07_02.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.iothub.v2021_07_02.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure.mgmt.iothub.v2021_07_02.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.iothub.v2021_07_02.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -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. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(TagsResource, self).__init__(**kwargs) - self.tags = tags - - -class TestAllRoutesInput(msrest.serialization.Model): - """Input for testing all routes. - - :ivar routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :vartype routing_source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_07_02.models.RoutingMessage - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", - "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", - "DeviceConnectionStateEvents". - :paramtype routing_source: str or ~azure.mgmt.iothub.v2021_07_02.models.RoutingSource - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_07_02.models.RoutingMessage - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_07_02.models.RoutingTwin - """ - 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. - - :ivar routes: JSON-serialized array of matched routes. - :vartype routes: list[~azure.mgmt.iothub.v2021_07_02.models.MatchedRoute] - """ - - _attribute_map = { - 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, - } - - def __init__( - self, - *, - routes: Optional[List["MatchedRoute"]] = None, - **kwargs - ): - """ - :keyword routes: JSON-serialized array of matched routes. - :paramtype routes: list[~azure.mgmt.iothub.v2021_07_02.models.MatchedRoute] - """ - 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. - - :ivar message: Routing message. - :vartype message: ~azure.mgmt.iothub.v2021_07_02.models.RoutingMessage - :ivar route: Required. Route properties. - :vartype route: ~azure.mgmt.iothub.v2021_07_02.models.RouteProperties - :ivar twin: Routing Twin Reference. - :vartype twin: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword message: Routing message. - :paramtype message: ~azure.mgmt.iothub.v2021_07_02.models.RoutingMessage - :keyword route: Required. Route properties. - :paramtype route: ~azure.mgmt.iothub.v2021_07_02.models.RouteProperties - :keyword twin: Routing Twin Reference. - :paramtype twin: ~azure.mgmt.iothub.v2021_07_02.models.RoutingTwin - """ - super(TestRouteInput, self).__init__(**kwargs) - self.message = message - self.route = route - self.twin = twin - - -class TestRouteResult(msrest.serialization.Model): - """Result of testing one route. - - :ivar result: Result of testing route. Possible values include: "undefined", "false", "true". - :vartype result: str or ~azure.mgmt.iothub.v2021_07_02.models.TestResultStatus - :ivar details: Detailed result of testing route. - :vartype details: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword result: Result of testing route. Possible values include: "undefined", "false", - "true". - :paramtype result: str or ~azure.mgmt.iothub.v2021_07_02.models.TestResultStatus - :keyword details: Detailed result of testing route. - :paramtype details: ~azure.mgmt.iothub.v2021_07_02.models.TestRouteResultDetails - """ - super(TestRouteResult, self).__init__(**kwargs) - self.result = result - self.details = details - - -class TestRouteResultDetails(msrest.serialization.Model): - """Detailed result of testing a route. - - :ivar compilation_errors: JSON-serialized list of route compilation errors. - :vartype compilation_errors: list[~azure.mgmt.iothub.v2021_07_02.models.RouteCompilationError] - """ - - _attribute_map = { - 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, - } - - def __init__( - self, - *, - compilation_errors: Optional[List["RouteCompilationError"]] = None, - **kwargs - ): - """ - :keyword compilation_errors: JSON-serialized list of route compilation errors. - :paramtype compilation_errors: - list[~azure.mgmt.iothub.v2021_07_02.models.RouteCompilationError] - """ - super(TestRouteResultDetails, self).__init__(**kwargs) - self.compilation_errors = compilation_errors - - -class UserSubscriptionQuota(msrest.serialization.Model): - """User subscription quota response. - - :ivar id: IotHub type id. - :vartype id: str - :ivar type: Response type. - :vartype type: str - :ivar unit: Unit of IotHub type. - :vartype unit: str - :ivar current_value: Current number of IotHub type. - :vartype current_value: int - :ivar limit: Numerical limit on IotHub type. - :vartype limit: int - :ivar name: IotHub type. - :vartype name: ~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword id: IotHub type id. - :paramtype id: str - :keyword type: Response type. - :paramtype type: str - :keyword unit: Unit of IotHub type. - :paramtype unit: str - :keyword current_value: Current number of IotHub type. - :paramtype current_value: int - :keyword limit: Numerical limit on IotHub type. - :paramtype limit: int - :keyword name: IotHub type. - :paramtype name: ~azure.mgmt.iothub.v2021_07_02.models.Name - """ - 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. - - :ivar value: - :vartype value: list[~azure.mgmt.iothub.v2021_07_02.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 - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.UserSubscriptionQuota] - """ - super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py deleted file mode 100644 index 3930a2f261c8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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_07_02/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py deleted file mode 100644 index ae124bde9b35..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_iot_hub_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_generate_verification_code_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_verify_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - certificate_name: str, - *, - if_match: str, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def list_by_iot_hub( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_list_by_iot_hub_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_by_iot_hub.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_description, 'CertificateDescription') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def generate_verification_code( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_generate_verification_code_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - if_match=if_match, - template_url=self.generate_verification_code.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def verify( - self, - resource_group_name: str, - resource_name: str, - certificate_name: str, - if_match: str, - certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') - - request = build_verify_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - certificate_name=certificate_name, - content_type=content_type, - if_match=if_match, - json=_json, - template_url=self.verify.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py deleted file mode 100644 index eaaac26f205a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_manual_failover_request_initial( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_02.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: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(failover_input, 'FailoverInput') - - request = build_manual_failover_request_initial( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self._manual_failover_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_manual_failover( - self, - iot_hub_name: str, - resource_group_name: str, - failover_input: "_models.FailoverInput", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_07_02/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py deleted file mode 100644 index 963f073a91cb..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py +++ /dev/null @@ -1,2655 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_stats_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_valid_skus_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_event_hub_consumer_groups_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_event_hub_consumer_group_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_jobs_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_job_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_quota_metrics_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_endpoint_health_request( - subscription_id: str, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_all_routes_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_test_route_request( - iot_hub_name: str, - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew') - path_format_arguments = { - "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_keys_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_keys_for_key_name_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_export_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_import_devices_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_description, 'IotHubDescription') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - if_match=if_match, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_description: "_models.IotHubDescription", - if_match: Optional[str] = None, - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(iot_hub_tags, 'TagsResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - iot_hub_tags: "_models.TagsResource", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either IotHubDescription or ErrorDetails or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription - or ~azure.mgmt.iothub.v2021_07_02.models.ErrorDetails] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('IotHubDescription', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_stats( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_stats_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_stats.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_valid_skus( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_valid_skus.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_valid_skus_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def list_event_hub_consumer_groups( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=self.list_event_hub_consumer_groups.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_event_hub_consumer_groups_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.get_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - 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: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') - - request = build_create_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - content_type=content_type, - json=_json, - template_url=self.create_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def delete_event_hub_consumer_group( - self, - resource_group_name: str, - resource_name: str, - event_hub_endpoint_name: str, - name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_event_hub_consumer_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - event_hub_endpoint_name=event_hub_endpoint_name, - name=name, - template_url=self.delete_event_hub_consumer_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_jobs( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_jobs.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_jobs_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_job( - self, - resource_group_name: str, - resource_name: str, - job_id: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_job_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - job_id=job_id, - template_url=self.get_job.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get_quota_metrics( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get_quota_metrics.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_quota_metrics_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_endpoint_health( - self, - resource_group_name: str, - iot_hub_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=self.get_endpoint_health.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_get_endpoint_health_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - iot_hub_name=iot_hub_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def check_name_availability( - self, - operation_inputs: "_models.OperationInputs", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(operation_inputs, 'OperationInputs') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_all_routes( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestAllRoutesInput", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestAllRoutesInput') - - request = build_test_all_routes_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_all_routes.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def test_route( - self, - iot_hub_name: str, - resource_group_name: str, - input: "_models.TestRouteInput", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(input, 'TestRouteInput') - - request = build_test_route_request( - iot_hub_name=iot_hub_name, - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - content_type=content_type, - json=_json, - template_url=self.test_route.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def list_keys( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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 - - @distributed_trace - def get_keys_for_key_name( - self, - resource_group_name: str, - resource_name: str, - key_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_keys_for_key_name_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - key_name=key_name, - template_url=self.get_keys_for_key_name.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def export_devices( - self, - resource_group_name: str, - resource_name: str, - export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') - - request = build_export_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.export_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def import_devices( - self, - resource_group_name: str, - resource_name: str, - import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs: Any - ) -> "_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_07_02.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_07_02.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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') - - request = build_import_devices_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.import_devices.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py deleted file mode 100644 index 4acecf4c39b0..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> 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_07_02.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', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - 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_07_02/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index bb1948f499fd..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,565 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> 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_07_02.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> "_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', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs: Any - ) -> 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_07_02.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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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', {})) - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, 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 - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **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_07_02/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py deleted file mode 100644 index f1cfa1dc27b1..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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 - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - group_id: str, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - group_id=group_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py deleted file mode 100644 index 95a0f5892e04..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 functools -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_subscription_quota_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-07-02" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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_07_02.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 - - @distributed_trace - def get_subscription_quota( - self, - **kwargs: Any - ) -> "_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_07_02.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', {})) - - - request = build_get_subscription_quota_request( - subscription_id=self._config.subscription_id, - template_url=self.get_subscription_quota.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, pipeline_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_07_02/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file